你的图片我电脑里看不到,用手机上的看到的貌似是页2为3,页3为6,设置你的config['uri_segment']=4,试试 ...
$config['base_url'] = base_url('index.php/home/category');
$config['total_rows'] = $this->newsmodel->count_rows($this->uri->segment(3));
$config['per_page'] = 3;
$config['uri_segment']= 4;
$config['use_page_numbers'] = TRUE;
回楼上哥们的话,uri_segment加了,貌似还不好使。{:3_48:}
是不是还缺什么东西着了 我搞定了。
$config['base_url'] = base_url('index.php/home/category/'.$this->uri->segment(3));
加上$config['base_url']里面加上.$this->uri->segment(3)即可。
function category(){
$data['header_title'] = "栏目列表";
$this->load->model('newsmodel');
$this->load->library('pagination');
$config['base_url'] = base_url('index.php/home/category/'.$this->uri->segment(3));
$config['total_rows'] = $this->newsmodel->count_rows($this->uri->segment(3));
$config['per_page'] = 3;
$config['uri_segment']= 4;
$config['use_page_numbers'] = TRUE;
$offset = $this->uri->segment(4,0);
/*或者
$pageNUM = $this->uri->segment(4)?$this->uri->segment(4):1;
if ($pageNUM==1){
$offset = 0;
}else{
$offset = $config['per_page']*($this->uri->segment(4)-1);
}
*/
$this->pagination->initialize($config);
$data['category'] = $this->newsmodel->get_category();
$data['get_category_name'] = $this->newsmodel->get_category_name($this->uri->segment(3));
$data['get_article'] = $this->newsmodel->get_article($this->uri->segment(3),$config['per_page'],$offset);
$this->load->view('newssys/header',$data);
$this->load->view('newssys/category');
$this->load->view('newssys/footer');
} codeigniter_lht 发表于 2013-2-19 15:21 static/image/common/back.gif
这个是正解!
可是,现在2、3对了,前面的链接少了category/1的参数,现在放在2、3上的url链接是这样:
一看就知道我不是大侠了,我刚学2个月,呵呵...这帖子的回复还是处女贴呢...你确实搞错了,建议你自己看看代码.$this->uri->segment(3)这是分类的ID是不?$config['base_url'] = base_url('index.php/home/category')这里是否少了什么?你的分类ID没传过去吧('index.php/home/category/$id')这是我乱给你的变量$id。自己再看看... 我之前说的“你的图片我电脑里看不到,用手机上的看到的貌似是页2为3,页3为6,设置你的config['uri_segment']=4,试试”,就是因为看到你的url第三、第四个字段没弄好... codeigniter_lht 发表于 2013-2-19 15:21 static/image/common/back.gif
这个是正解!
可是,现在2、3对了,前面的链接少了category/1的参数,现在放在2、3上的url链接是这样:
怎么CI都有这个问题,一同求解
页:
1
[2]