CI ,伪静态分页问题。。。。。。。。。
http://WWW.XXXX.com/index/more/new.shtml/2这是目前分页的样子
我想让它变成这个样子
http://WWW.XXXX.com/index/more/new/2.shtml
该怎么做,具体点,帮忙一下。
控制器:
function more($type ='good') {
$session = $this->m_index->get_session ();
$view_datas ['uname'] = $session ['uname'];
$type = $type ? $type : 'new';
$count = $this->m_index->counts ( 'essay' );
$this->load->library ( 'pagination' );
$config ['base_url'] = site_url("index/more/".$type);
$config ['total_rows'] = $count;
$config ['per_page'] = 6;
$config ['uri_segment'] = 4;
$config ['full_tag_open'] = '<p style="float:right; margin-right:30px;">';
$config ['full_tag_close'] = '</p>';
$config ['last_link'] = '尾页';
$config ['first_link'] = '首页';
$config ['next_link'] = '下一页';
$config ['prev_link'] = '上一页';
$page=(int)$this->uri->segment ( 4 );
$start = $page ? $page : 1;
$start = $start * 6 - 6;
$config ['use_page_numbers'] = TRUE;
$this->pagination->initialize ( $config );
$view_datas ['pages'] = $this->pagination->create_links ();
$view_datas ['datas'] = $this->m_index->more ( $type, $start, $config ['per_page'] );
$this->load->view ( 'more', $view_datas );
}
本帖最后由 yggdrasil 于 2014-4-22 11:37 编辑
在config.php $config['url_suffix'] 加上.html 就可以了 伪静态
分页的话你这样试试 $config ['total_rows'] =$this->db->count_all_results('表名');
$config ['per_page'] = $prepage; // 个人是单独设置成一个变量 $prepage = 6;
$page=(int)$this->uri->segment ( 4 ); //偏移
$this->db->limit('$prepage',$page); //起始,取的条数
好了..去模板上 echo $pages 看看 :D:D:D:D:D:D:D:D:D:D:D:D
页:
[1]