|
在写1个博客,遇到个问题 就是首页分页问题,,
代码如下:
$data['search_all'] = $this->article_model->get_all_page('',$title,$catid,'','','','','');
//分页
$total_rows=count($data['search_all']); //行数
//设定分页的根链接
$config = array();
$this->load->library('hpages');
//$config['base_url'] = site_url('welcome');
$config['base_url'] = "welcome/index"."?title=$title";
$config['total_rows'] = $total_rows; //总记录数
$config['per_page'] = 3; //每页显示记录数
$config['num_links'] = 3; //前面和后面的页面数
/*$config['prev_link'] = '上一页'; //上一页
$config['next_link'] = '下一页'; //下一页
$config['first_link'] = '首页'; //首页
$config['last_link'] = '末页'; //末页*/
$config['underline_uri_seg'] =1;
$this->hpages->init($config);
$data['page_str']=$this->hpages->create_links(1);
/**文章列表**/
$data['init_art'] = $this->article_model->get_all_page('',$title,$catid,'','','',$from_row,$config['per_page']);
$this->load->view('welcome',$data);
但是首页显示的是全部数据 并没有按设置的显示3条数据
这个是首页截取的部分的图片
|
|