Welcome Guest, Not a member yet? Register   Sign In
URL Parameter passing
#4

[eluser]Lyon[/eluser]
[quote author="mddd" date="1279892292"]You can use $uri->uri_to_assoc(). It makes the uri parts into an associative array.
For instance if you call /controller/method/id/123/name/john, then $uri->uri_to_assoc() will give you array ('id'=>123, 'name'=>'john').

You can combine this with 'fixed' variables (not having a name, like your value '12'. You can do this by giving the number of the first segment where you want to start the 'name/value' parts. Normally that number is 3 because the first is the controller, second is the method and then the parameters start. But you could have /controller/method/12/id/123/name/john and get $uri->uri_to_assoc(4) and that would get you the same array as before. You can get the first parameter seperately using $uri->segment(3).[/quote]

That's pretty cool.
Actually helps me with my site as well.
Thanks!


Messages In This Thread
URL Parameter passing - by El Forum - 07-22-2010, 06:58 PM
URL Parameter passing - by El Forum - 07-23-2010, 02:28 AM
URL Parameter passing - by El Forum - 07-23-2010, 02:38 AM
URL Parameter passing - by El Forum - 07-23-2010, 03:14 AM
URL Parameter passing - by El Forum - 07-23-2010, 03:19 AM
URL Parameter passing - by El Forum - 07-26-2010, 11:29 AM
URL Parameter passing - by El Forum - 07-27-2010, 12:05 AM



Theme © iAndrew 2016 - Forum software by © MyBB