can someone help me with pagination?
I'm currently using the Pagination Class and when I use $config['use_page_number'] = TRUE it's not working properly
is display the data but incorrect. it uses the URI Segment above as offset.
example in page 1 (base_url/controller/method) it doesn't have any URI segment so it displays properly.
when I go to page 2 the link looks like this
base_url/controller/method/2
it display it BUT it display the wrong list of data.
it uses the 2 above in the link as offset...
so instead of 11-20 it display 3-12
in page 3 (base_url/controller/method/3)
is display 4-13. it uses the 3 as offset
this is the code.
// Controller
$limit = 10;
$data['categories'] = $this->model->get_all_categories($this->limit);
$config['base_url'] = site_url('admin/category_list');
$config['total_rows'] = $this->model->count_categories();
$config['per_page'] = $this->limit;
$config['uri_segment'] = 3;
$config['num_links'] = 2;
$config['use_page_numbers'] = TRUE;
//Model
public function get_all_categories($limit = 10) {
return $this->db->limit($limit, $this->uri->segment(3))->get($this->tbl_categories)->result_object();
}
public function count_categories() {
return $this->db->count_all_results($this->tbl_categories);
}
AND OH if I set $config['use_page_numbers'] = FALSE it works properly cause the link above is
base_url/method/ Page 1
base_url/method/10 Page 2
base_url/method/20 Page 3
so it uses the URI Segment properly. but I wanted to use page numbers I can't seem to fix it..
if anyone can help that would be great for the mean time I'll set the value to FALSE