|

楼主 |
发表于 2013-2-20 10:49:50
|
显示全部楼层
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');
} |
|