douxian3828 2013-07-10 09:38
浏览 47
已采纳

网站模板/设计的建议 - 后端

I'm creating a website using Codeigniter which hosts online novels/e-books. The novel(s) have multiple chapters similar to a hard copy. Im planning to design the layout as following.

User goes to chapter 1, so the URL would be site.com/novel/chapter1/pageno

I plan to create a novel controller which has chapter1,2.. etc as its functions. The chapter function receives an input and gets the same form either a database or from a text file. I'd also want to store user progress which can be resumed later. I plan to use the chapter/pageno as the reference for where the user currently has stopped.

I'd like to know if this approach is good and is it possible to limit the functions and make it more generic. Alternative approach to this concept would also be helpful.

  • 写回答

1条回答 默认 最新

  • douyao6842 2013-07-10 10:16
    关注

    yes you can make it more generic it routes you have to add route in routes.php under config directory like this

    $route['novel/(chapter-[0-9]+)/(:any)'] = 'novel/chapter/$1/$2';
    

    now url will be www.site.com/novel/chaper-20/60

    novel controller

    class Novel extends CI_Controller{
    
    
      function chapter($chaper_no,$page_no){
    
         echo $chpter_no,'  ',$page_no;
      }
     // if you don't want to pass variables to chapter function use the following
    
      function chapter(){
            $chapter_no = $this->uri->segment(2);
            $page_no = $this->uri->segment(3);
      }
    
    }
    

    if you are registering users in you site create a bookmark link ask him to save the page, if you are not registering users on your site you can set cookie to save user progress by just clicking same bookmark link or make it on each page load

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 2020长安杯与连接网探
  • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么
  • ¥15 banner广告展示设置多少时间不怎么会消耗用户价值
  • ¥16 mybatis的代理对象无法通过@Autowired装填
  • ¥15 可见光定位matlab仿真
  • ¥15 arduino 四自由度机械臂
  • ¥15 wordpress 产品图片 GIF 没法显示
  • ¥15 求三国群英传pl国战时间的修改方法
  • ¥15 matlab代码代写,需写出详细代码,代价私
  • ¥15 ROS系统搭建请教(跨境电商用途)