用户
 找回密码
 入住 CI 中国社区
搜索
查看: 2665|回复: 3
收起左侧

[讨论/交流] ci 分页问题

[复制链接]
发表于 2012-8-9 17:12:28 | 显示全部楼层 |阅读模式
代码:
       $this->load->library('pagination');
       $this->load->helper('url');

        $config['base_url'] = base_url().'index.php/book/book/index';
        $config['total_rows'] = $this->db->count_all('book');
        $config['per_page'] = 3;
        $config['uri_segment'] = 1;
        $config['num_links'] = 3;
        $config['underline_uri_seg'] = 1;
        $this->pagination->initialize($config);
        $data['page'] = $this->pagination->create_links();
       
        $data['title'] = '我的留言本';
        $data['book'] = $this->book_model->show(FALSE,$config['per_page'],$this->uri->segment(4));

第一次下一页 就是数字2 在点击还是数字2
发表于 2012-8-9 20:58:38 | 显示全部楼层
你的设置$config['uri_segment']=1;应该有问题

'uri_segment'是指URI 的哪个部分包含页数

如我的URI为http://127.0.0.1/BlogCI/index.php/Project/index/2

设置为:
$config['uri_segment'] = 3;
 楼主| 发表于 2012-8-10 09:29:04 | 显示全部楼层
wx2650 发表于 2012-8-9 20:58
你的设置$config['uri_segment']=1;应该有问题

'uri_segment'是指URI 的哪个部分包含页数

好了 谢谢您
发表于 2012-10-23 10:31:12 | 显示全部楼层
$this->book_model->show(FALSE,$config['per_page'],$this->uri->segment(4));

show这个函数怎么写啊??

本版积分规则