Welcome Guest, Not a member yet? Register   Sign In
uri segments order
#1

[eluser]al404[/eluser]
i'm just beginning with CI and i was wondering how to pass my war on URL

for example some url can miss some parameters

lets say that i have a basic url like this:
http://example.com/newsshow.php?orderby=data&limit=10

http://example.com/news/show/data/10

whatappens if i don't need on some link orderby parameter?

http://example.com/news/show//10
i wouldn't like something like this
#2

[eluser]xwero[/eluser]
You could detect the parameter by the type
Code:
if(is_numeric($this->uri->segment(3)))
{
   $limit = $this->uri->segment(3);
}
else
{
   $orderby = $this->uri->segment(3);
}
Another way to go is to add the key in front of the value like a query string and use the $this->uri->uri_to_assoc(n) method.




Theme © iAndrew 2016 - Forum software by © MyBB