• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Adding querystrings

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:
Or maybe this:
What's the best way to include variable parameters without making my life too difficult later on?

[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.


Thanks for your reply.

I usually use


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.

[eluser]Colin Williams[/eluser]
Check out $this->uri->uri_to_assoc(n) at http://ellislab.com/codeigniter/user-gui...s/uri.html

Exactly! Wink

[quote author="Colin Williams" date="1214216681"]Check out $this->uri->uri_to_assoc(n) at http://ellislab.com/codeigniter/user-gui...s/uri.html[/quote]
That's great. Thanks!

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.