How I got around $_GET restrictions - 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: How I got around $_GET restrictions (/showthread.php?tid=40279) |
How I got around $_GET restrictions - El Forum - 04-04-2011 [eluser]Unknown[/eluser] I wanted to use get vars but didn't want to make some crappy URL like index.php?c=bla&m=bla This is used for search results in my app so I can keep it pretty http://www.mysite.com/search/?q=someurlencodedstuff Here is the simple code I put in my model that handles search results Here is how i did it recently. I'm sure it will piss off some purists, but google search indicates that people really want to be able to use CI with a feature like this... so this is an easy "in place" solution you can use Code: <?php How I got around $_GET restrictions - El Forum - 04-04-2011 [eluser]ChrisMiller[/eluser] Or you could just change your config variable uri_protocol from auto to paht info Code: $config['uri_protocol'] = 'PATH_INFO'; and then add this to your controller or wherever you want to repopulate the _GET variable Code: parse_str($_SERVER['QUERY_STRING'],$_GET); But your way is just a lil longer thats all.... How I got around $_GET restrictions - El Forum - 04-05-2011 [eluser]Unknown[/eluser] thanks for the reply... what does "PATH_INFO" uri_protocol enable? I'm concerned it would have unforeseen consequences thanks, if it works in my scenario i think it might be OK but i want all the other urls existing to work the normal way... just using $_GET for search page only How I got around $_GET restrictions - El Forum - 04-05-2011 [eluser]ChrisMiller[/eluser] [quote author="ladieu" date="1302001494"]thanks for the reply... what does "PATH_INFO" uri_protocol enable? I'm concerned it would have unforeseen consequences [/quote] As far as I know it really has no effect at all in regards to unforseen consequences it just changes the way codeigniter interperts urls. I had to change that before to keep the urls from getting buggy on me. It is used on a production server now for several months, if not over a year and no problems at all. |