Pagination - 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 (/showthread.php?tid=4342) |
Pagination - El Forum - 11-19-2007 [eluser]skeletonfriend[/eluser] How do I use the pagination class? I have my controller, model, and view. In the view I have the correct amount of rows shown and pagination-links are there too, but when I try to click on of the page-links, I get an 404! What can be the problem? Code: // controller Pagination - El Forum - 11-19-2007 [eluser]skeletonfriend[/eluser] solved! Pagination - El Forum - 11-19-2007 [eluser]Chris Newton[/eluser] So, what was the solution? Pagination - El Forum - 11-19-2007 [eluser]cinewbie81[/eluser] base_url problem i believe Pagination - El Forum - 11-20-2007 [eluser]skeletonfriend[/eluser] Yepp, the problem was related to the base_url(); I changed: Code: $config['base_url'] = base_url() . 'blog/'; to: Code: $config['base_url'] = base_url() . 'blog/index'; Pagination - El Forum - 11-20-2007 [eluser]jvittetoe[/eluser] Code: 'blog/index' Pagination - El Forum - 11-20-2007 [eluser]skeletonfriend[/eluser] beats me. Pagination - El Forum - 12-18-2007 [eluser]BravoAlpha[/eluser] [quote author="skeletonfriend" date="1195522636"] Code: // controller The Pagination class will look for the page number at "uri_segment" 3 by default; However, in your `base_url`, it would be the second segment. Pagination - El Forum - 12-19-2007 [eluser]JamesD[/eluser] You could always change the 'uri_segment' to override the default segment too. For example... Code: $config['uri_segment'] = 2; -JamesD Pagination - El Forum - 12-19-2007 [eluser]ejangi[/eluser] You should really change that config item from: Code: $config['base_url'] = base_url() . 'blog/index'; to Code: $config['base_url'] = 'blog/index'; because all base_url() does is return the value for $config['base_url'] - so, you've got this recursive loop thing going on at the moment. It's probably not hurting your application, because as it stands base_url() is just returning a null string, but there's no point having it in your config item. /system/helpers/url_helper.php: Code: /** |