How I got around $_GET restrictions |
[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
[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....
[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
[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. |
Welcome Guest, Not a member yet? Register Sign In |