Welcome Guest, Not a member yet? Register   Sign In
Array as URI Segment ?
#1

[eluser]Portishead[/eluser]
As a Newbie I tried to use an array variable as a parameter over the URI.

As mentioned in the User Guide....

If your URI contains more then two segments they will be passed to your function as parameters.

For example, lets say you have a URI like this:

example.com/index.php/products/shoes/sandals/123
Your function will be passed URI segments 3 and 4 ("sandals" and "123"):



Where exactly does it say that the parameters can't be arrays ?
It took me hours of searching and finally I got the answer from
a friend who is using CI a couple of years.

Frustrating huh ?
#2

[eluser]TWP Marketing[/eluser]
It could be, but you're talking about HTML and how the server handles URL's, which doesn't include an array parsing ability. That is outside of CI's venue.

If you have so much information that it must be passed in an array, POSTing the information is safer.

If the amount of data is smaller, say under five fields, you can make a long URL with a segment for each field. I wouldn't try to do much more than that many, although is it technically possible. Look at the ugly URL's generated for some of the large catalog sites.
[EDIT spelling...]
#3

[eluser]Portishead[/eluser]
Thanks for the reply.
Smile
#4

[eluser]Abel A.[/eluser]
The goal of CI is to make urls look cleaner. Adding or trying to add arrays defeats the purpose.
#5

[eluser]Portishead[/eluser]
[quote author="Abel A." date="1343867545"]The goal of CI is to make urls look cleaner. Adding or trying to add arrays defeats the purpose.[/quote]

I agree totally.
But it should be mentioned in the User Guide.
#6

[eluser]CroNiX[/eluser]
Quote:Where exactly does it say that the parameters can’t be arrays ?
Where does it say they are supposed to be?

Have you ever seen a manual that told you what datatypes you AREN'T supposed to use as a parameter? That would be quite a large manual.




Theme © iAndrew 2016 - Forum software by © MyBB