[eluser]markowe[/eluser]
OK, $this->uri->uri_to_assoc(n) - is great: from a URI like:
Code:
index.php/user/search/name/joe/location/UK/gender/male
we end up with an array like:
Code:
[array]
(
'name' => 'joe'
'location' => 'UK'
'gender' => 'male'
)
(taken from the docs)
...BUT I don't really want that great big URI, with the parameter NAMES in - I mean
I know which parameter is which. It would make for better code if there was a class that would let me specify parameter names:
$paramNames = array ('name', 'location', 'gender');
and then match the URI segments in corresponding order, using these as key names. That way I would still end up with
Code:
'name' => 'joe'
'location' => 'UK'
'gender' => 'male'
...but from a URI in the form:
Code:
index.php/user/search/joe/UK/male
i.e. without the parameter names appearing in the URI. Then I could use e.g.
Code:
$name = $uriArray ['name'];
...which is obviously nicer than referring to the parameters by segment number.
I am pretty sure there isn't a helper available to achieve this, am I right? Is there any reason for that, if not? I know it would be easy to write, just wondering... Suggestion for a future addition?