pagination from index function? - 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: pagination from index function? (/showthread.php?tid=32661) |
pagination from index function? - El Forum - 07-30-2010 [eluser]Corey Freeman[/eluser] sorry to bother everyone again. I'm using the Ajax Pagination library and I can't manage to paginate results from the controller's index (which would make the interface look so much cleaner...). Any help would be awesome. Code: <?php pagination from index function? - El Forum - 07-30-2010 [eluser]mddd[/eluser] If a user calls /dashboard/2 the system will look for a method called '2' in the Dashboard controller. That's not working. You have some options: - use urls like /dashboard/index/2 - add a _remap function in the controller to always call index(): function _remap() { $this->index(); } or even simpler, rename your index() method _remap() - add a route to your config/routes.php to rewrite the url: $route['dashboard/(:num)'] = 'dashboard/index/$1'; pagination from index function? - El Forum - 07-30-2010 [eluser]Corey Freeman[/eluser] You totally rock! The routes thing worked fantastically. pagination from index function? - El Forum - 07-30-2010 [eluser]mddd[/eluser] No problem |