Custom Pagination Question |
[eluser]monfreex[/eluser]
What approach would you take if you have a page that displays a single result from the DB, and you have previous and next links in the same page that would also display the previous and next records? My current url is: /index.php/member/4 (screenshot below) Do you have any better suggestions for the URL? It would be helpful if you could please outline the solutions for the controller and for the model (if necessary). I would very much appreciate any hints on how to solve this. Thank you.
[eluser]Dam1an[/eluser]
Well, for a start, you'll want to remove index.php from your URL to make them prettier As for the previous/next links, you need something like this in your views Code: <?=anchor('members/'.$this->uri->segment(1)-1, 'Previous')?> | <?=anchor('members/'.$this->uri->segment(1), 'Next')?> You will obviously need a check to make sure you don't hit 0 or number of members +1
[eluser]monfreex[/eluser]
Thank you for the suggestion Dam1an but the URI segment is the ID of the record. I guess what I need is to store all the ID's into an array then put them in the pagination. |
Welcome Guest, Not a member yet? Register Sign In |