![]() |
Adding querystrings - 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: Adding querystrings (/showthread.php?tid=9352) |
Adding querystrings - El Forum - 06-22-2008 [eluser]mattalexx[/eluser] The problem with the whole "/controller/action/param1value/param2value/param3value" thing is, the parameters do not have keys and so flexibility is lost (what if I wanted to include param3 but not param1 or param2?). It would be cool if I could do something like this: Code: /controller/action/param1value/param3key:param3value Code: /controller/action/param1value?param3key=param3value Adding querystrings - El Forum - 06-22-2008 [eluser]Randy Casburn[/eluser] Have you looked at routing? With the ability to use wildcard routing thus: $route['param3key/:num'] = "yourController/your_param3_method"; $route['param2key/:num'] = "yourController/your_param2_method"; $route['param1key/:num'] = "yourController/your_param1_method"; You can define as many as you need. This provides the flexibility you seek, just with slightly different terminology than you use. I think if you explore this it may work for you. Randy Adding querystrings - El Forum - 06-22-2008 [eluser]mattalexx[/eluser] Thanks for your reply. Adding querystrings - El Forum - 06-22-2008 [eluser]SeanJA[/eluser] I usually use desc1/param1/desc2/param2 Then I use the uri functions to pull the uri out and just see what is in the uri, then I can expand it without having any big rewrites. Adding querystrings - El Forum - 06-22-2008 [eluser]Colin Williams[/eluser] Check out $this->uri->uri_to_assoc(n) at http://ellislab.com/codeigniter/user-guide/libraries/uri.html Adding querystrings - El Forum - 06-22-2008 [eluser]SeanJA[/eluser] Exactly! ![]() Adding querystrings - El Forum - 06-23-2008 [eluser]mattalexx[/eluser] [quote author="Colin Williams" date="1214216681"]Check out $this->uri->uri_to_assoc(n) at http://ellislab.com/codeigniter/user-guide/libraries/uri.html[/quote] That's great. Thanks! |