CodeIgniter Forums
Help with pagination (use page numbers) :( - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Help with pagination (use page numbers) :( (/showthread.php?tid=47493)



Help with pagination (use page numbers) :( - El Forum - 12-11-2011

[eluser]victorche[/eluser]
I like the new feature to use page numbers instead of the offset, but I thought it is easy as adding just one line to the config array. Like:
Code:
$config['use_page_numbers'] = TRUE;
And I did so, but unfortunately this is not the only change maybe. Because now my pages are wrong. For example, if I have:
Code:
function news($offset = NULL)
{
$limit = 10;
Then the offset is not 10 anymore, but 2 (10 was the previous, now it is page 2)
So the database query is also different.
From my model:
Code:
->limit($limit, $offset)
->get();
Really, this pagination is really hard for me and I can not think about the reason for the mistake. If I manually type the url like this:
/news/10 (the old behavior)
it is Ok...
With a link like:
/news/2
It is now working Sad
What else should I change for that? Please, someone!