|
不加路由,分页好好的,加路由就不行了,帮忙看看,,,,,
路由代码
PHP复制代码
$route['default_controller'] = 'article';
$route['article/(:num)'] = 'article/article_view/$1';
$route['list/(:num)'] = 'article/article_list/$1';
复制代码
C代码
PHP复制代码
function article_list ($typeid){
$map['typeid'] = intval($typeid);
$query=$this->db->get_where('article',$map);
$rows = $query->num_rows();
//分页start
$config['base_url'] = base_url ().'article/article_list/'.$map['typeid']; //路由后的=>//base_url().'list/'.$map['typeid'];
$config['uri_segment'] = 4; //路由后的=>//$config['uri_segment'] = 3;
$config['total_rows'] = $rows;
$config['per_page'] = 5;
$config['num_links'] = 4;
$config['first_link'] = '首页';
$config['last_link'] = '尾页';
$config['suffix'] = '.shtml';
//$config['use_page_numbers'] = TRUE;
$this->pagination->initialize($config);
$query=$this->db->get_where('article',$map,$config['per_page'],$this->uri->segment(4)); //路由后的=>//3
$list = $query->result_array();
$page = $this->pagination->create_links();
$data = array('list'=>$list,'page'=>$page);
$this->header();
$this->load->view('article/article_list',$data);
$this->footer();
}
复制代码
|
|