[eluser]Unknown[/eluser]
Hi,
I was having an issue with Pagination library. my page url was /controller/method.html. when I wrote the following code:
Code:
$this->load->library('pagination');
$pagi['base_url'] = site_url('controller/method');
$pagi['total_rows'] = 3000;
$pagi['per_page'] = 20;
$this->pagination->initialize($pagi);
I was getting links like:
/controller/method.html/20
/controller/method.html/40
and they were not working. after lots of trials and errors, I got it working this way:
Code:
$this->load->library('pagination');
$pagi['base_url'] = base_url();
$pagi['prefix'] = 'controller/method/';
$pagi['suffix'] = config_item('url_suffix');
$pagi['first_url'] = site_url('controller/method');
$pagi['total_rows'] = 3000;
$pagi['per_page'] = 20;
$this->pagination->initialize($pagi);
Now the url is like:
/controller/method/XX.html. XX is replaced by starting number like 20, 40 etc.
Everything is working as expected but I want to know whether is this the correct way of doing this or there are others best ways of handling this?
Thanks in advance