设置了url_suffix后分页问题
本帖最后由 chenhan 于 2009-9-20 22:50 编辑1、出于SEO考虑,想把有些页面可以用HTML后缀访问,看了手册发现设置了$config['url_suffix'] = ".html"就能实现以HTML后缀访问;可是问题来了,在分页地址也自动加了html,变成了/zufang/index.html/1,这个好像不大好吧,请问有什么解决的办法可以变成:/zufang/index/1
2、另外请问大家做站有设置这个成为HTML吗?还是通过REWRITE来实现伪静态的呢
代码贴出来大家看看:
$this->load->library('pagination');//分页类
$config['base_url'] = site_url('/qiuzhu/index'); //注意"index"必须要.
$config['total_rows'] = $this->qiuzhum->get_qzcount('61');//数据总行数
$config['per_page'] = 15; //每页显示数
$config['uri_segment'] =3;
$config['num_links'] = 6;
$config['full_tag_open'] = '<p>';
$config['full_tag_close'] = '</p>';
$config['first_link'] = '首页';
$config['last_link'] = '尾页';
$config['next_link'] = '下一页';
$config['prev_link'] = '前一页';
$this->pagination->initialize($config); //初始化分页
$data['pagelink'] =$this->pagination->create_links();
$StartRow = 0;//开始显示记录的编号
if($this->uri->segment(3)){//如果为空,则表示第1页
$StartRow = $this->uri->segment(3);//获得开始显示的记录编号
}
$data['qzdata']=$this->qiuzhum->get_qzlist('61',$StartRow,$config['per_page']);
$this->load->view('qiuzhu',$data); 分页代码写的不对 楼上是说是我的代码写得不对,如果对的话就不会/zufang/index.html/1是吗? 我记得的是分页类不支持 URL 后缀,不知道新版修正没修正? 我就是不要后缀的,可是设置后他自己加上去的,我希望地址是:/zufang/index/1
怎么样才能不要加上后缀呢 $config['base_url'] = site_url('/qiuzhu/index'); //注意"index"必须要.
这句写的不对,site_url()会自动追加后缀
要改成 = site_url().'/qiuzhu/index';
然后扩展分页类追加后缀 请问哪里有例子吗? 这个就要自己扩展咯,分页类的源码不难 哈哈,没注意看手册,用base_url就正常了,谢谢二位了 chenhan 发表于 2009-9-22 10:04 static/image/common/back.gif
哈哈,没注意看手册,用base_url就正常了,谢谢二位了
{:soso_e179:}学习了,我也是刚碰到这个问题!!!
页:
[1]
2