Welcome Guest, Not a member yet? Register   Sign In
pagination library issue
#1

[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
#2

[eluser]web-johnny[/eluser]
I actually worked with url_suffix before 1 year and it was confusing. When I started not to use it my life get's easier. There is no reason to use url_suffix = '.html' . So a better way to do this work ( and right ) is to not use url_suffix :-) . You will not ever have problem with paging, site_url , parameters of functions etc etc....
#3

[eluser]InsiteFX[/eluser]
CodeIgniter - Pagination Example

InsiteFX




Theme © iAndrew 2016 - Forum software by © MyBB