CodeIgniter Forums
Pagination Class Suggestion - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=22)
+--- Thread: Pagination Class Suggestion (/showthread.php?tid=19802)



Pagination Class Suggestion - El Forum - 06-18-2009

[eluser]Unknown[/eluser]
In my app, I enabled querystrings, but didn't want or need them for my search page. I was unable to override this setting and disable querystring pagination, so I modified lines 123 and 173 of the Pagination class so that I could accomplish this by setting
Code:
$config['page_query_string']
to
Code:
false
.

Both lines of code should look like this:
Code:
if (($CI->config->item('enable_query_strings') === TRUE OR $this->page_query_string === TRUE) && $this->page_query_string !== false)

Thought I'd share, in case anyone else was running into the same issue.


Pagination Class Suggestion - El Forum - 06-20-2009

[eluser]topherdan1[/eluser]
Thanks for posting the code! This was the perfect solution to the problem I was running into. I would suggest that this be part of the core pagination code. I think a lot of people use enable_query_strings and still want url-friendly pagination


Pagination Class Suggestion - El Forum - 06-20-2009

[eluser]xwero[/eluser]
If you want mixed urls you better change the uri_protocol setting and fetch the GET global in the controller constructor or method using
Code:
parsestr($_SERVER['QUERY_STRING'],$_GET);

Enabling the query string is a hack to get mixed urls but it's a bad thing if you extend that hack to another library. In CI logic if you enable the query string you are going to use query string urls not mixed urls.