[eluser]Jin Nguyen[/eluser]
I did pagging at index.php but i can do it at categories
But what the paging needs "$this->uri->segment(3)".
I used "$this->uri->segment(3)" to get categories_id. I add the "$this->uri->segment(4)" but it just jumps to the last page of crude(this page valuable segment (4)). The remaining pages are not segment (4).
help me!
Controller
Code:
function categories(){
$category_book = $this->uri->segment(3);
$where = array('category_id' => $category_book);
$this->load->library('pagination');
$start_row = $this->uri->segment(4);
$per_page = 5;
if(trim($start_row)=='')
{
$start_row = 0;
}
$things = $this->global_model->get_total_number_record('sach',$where);
$total_row = $things;
$config['base_url'] = site_url().'/site/categories/'.$category_book.'/';
$config['total_rows'] = $total_row;
$config['per_page'] = $per_page;
$this->pagination->initialize($config);
$paging = $this->pagination->create_links();
$data=array(
'Sach' => $this->global_model->get_info_type_book($where,$per_page,$start_row),
'pagination' => $paging,
'view'=>'site/sanpham/showSach'
);
$this->load->view('site/templates/default/index',$data);
}