CodeIgniter Forums
Pagination of Home page - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21)
+--- Thread: Pagination of Home page (/showthread.php?tid=24168)



Pagination of Home page - El Forum - 11-02-2009

[eluser]jabga[/eluser]
Hi guys, I would like to insert pagination on my front page.
should I get number of page from _GET and set LIMIT in my model ?
Let's imageine if our url was like this index.php/blog/1 or index.php/blog or index.php/blog/20
Page number is number of segment.

I would like to show 10 news per page.
So my algoritm should be like this

If uri segment is null or 0 orr <1, page number is 1.
else model function limit should be between Segment3 and segment3 x 10.
Next link should point to uri segment + 1.
Last page link should be equal to number of ID / number of news per page (number of id/10)

Is it right? How should it be?
Suggest me please
It would be nice if you can show me code or example. thanks.

Please note I used CI pagination in single pages. But can't use it on frontpage