Welcome Guest, Not a member yet? Register   Sign In
CI Pagination
#1

[eluser]hyeteck[/eluser]
Hi,

Is there an option to change the way the pagination class works so that the option passed in to the URI is the actual page number?

For example. If you have 5 items per page, your uri looks something like the following:

.../page/5 <--that would be the first page
.../page/10 <-- that would be the second page
.../page/15 <-- and that is the third page.

is there a way to actually pass the page number into the uri? for example:

.../page/1
.../page/2
.../page/3

Thanks
#2

[eluser]spider pig[/eluser]
Wouldn't the first page start at zero?

Once you get the hang of it, the CI Pagination feature is great. Before I had to calculate the start value:

Code:
$query = "select * from table limit ".(($page-1) * $items).",".$items;

Now the code is cleaner:

Code:
$start = $this->uri->segment(5, 0);
$query = "select * from table limit ".$start.",".$items;

You can always calculate the page:

Code:
$page = ceil($start/$items);
#3

[eluser]Bramme[/eluser]
It would probably require a MY_Pagination, but it's certainly doable.




Theme © iAndrew 2016 - Forum software by © MyBB