我就是ZERO 发表于 2011-8-17 10:07:44

CI分页的问题,怎么样都只是显示前5条信息

$this->load->library('pagination');
                $config['total_rows'] = $this->blog_model->blog_list($content,'count');
      $config['base_url'] = site_url('/blog/topic/index/'.$code);
                $config['per_page'] = 5;
                //$config['page_query_string'] = TRUE ;
                $config['uri_segment'] = 4;
                //print_r($this->uri->segment(2));die();
                $this->pagination->initialize($config);
                $html['blog_list'] =$this->blog_model->blog_list($content,$this->pagination->limit_string());
                $html['total_row'] = $this->blog_model->blog_list($content,'count');
                $html['links'] = $this->pagination->create_links();
我的链接:http://y3.com/blog/topic/index/55S35Lq66IqC/0

$this->uri->segment(4) 这个方法截取的URI段是55S35Lq66IqC。
不知道为什么,点下一页的时候还是第一页的5条信息...求解..

Hex 发表于 2011-8-17 13:42:49

你的页数明显是在第五段,要设置 $config['uri_segment'] = 5;
页: [1]
查看完整版本: CI分页的问题,怎么样都只是显示前5条信息