Pagination not passing parameters as URI Segment - 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 not passing parameters as URI Segment (/showthread.php?tid=20640) |
Pagination not passing parameters as URI Segment - El Forum - 07-16-2009 [eluser]emelpy[/eluser] I am trying to use pagination to show a list of news articles from my database. My URL structure is /admin/news/showlist/ where admin is a directory and showlist is a function in the news controller. Here is the code: Code: function showlist() My problem is that CodeIgniter does not seem to be passing the per_page variable correctly. In the documentation is says that it should default to passing it as a segment e.g. /admin/news/showlist/10 where 10 is the current offset. This is not how it is working for me. For some reason the links codeigniter is generating with pagination->create_links() look like /admin/news/showlist/&per_page=10. This looks kind of like it's passing it via GET but when I do a var_dump on $_GET it is empty. As you can see I hacked the per_page value out of the URL using uri->segment. This works when going from page 1 to 2 but codeigniter fails to hyperlink page 1 once I am at page 2. Any ideas on this? Pagination not passing parameters as URI Segment - El Forum - 07-16-2009 [eluser]Dam1an[/eluser] Do you not need to set Code: $config['uri_segment'] = 4; Pagination not passing parameters as URI Segment - El Forum - 07-16-2009 [eluser]emelpy[/eluser] [quote author="Dam1an" date="1247789887"]Do you not need to set Code: $config['uri_segment'] = 4; Hey, thanks for the quick reply. It looks like in the global config file we have $config['enable_query_strings'] = TRUE; Adding $this->config->set_item('enable_query_strings', 'FALSE'); to the top of my showlist function fixed this for me. You mean take offset as a param to showlist? |