CodeIgniter Forums
problem retrieving uri segments using $this->uri->segment() - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: problem retrieving uri segments using $this->uri->segment() (/showthread.php?tid=37368)



problem retrieving uri segments using $this->uri->segment() - El Forum - 01-07-2011

[eluser]mobilizedesign[/eluser]
when i try to assign a value to a variable like this ...
Quote:$variable = $this->uri->segment(n);

i get nothing. when i make a slight change ...

Quote:$variable = $this->uri->segment(n,0);

i get the FALSE value ( 0 in this case )

my nav links are setting the uri like this ... http://www.domain.com/codeigniter/index.php/home/collections/n

why am i unable to access uri using segments()? is this related to the routes.php file?

is $this->uri->segment(n,0) incompatible when using QUERY_STRING config?


problem retrieving uri segments using $this->uri->segment() - El Forum - 01-07-2011

[eluser]mobilizedesign[/eluser]
changed the $config['uri_protocol'] to

Code:
$config['uri_protocol']    = "REQUEST_URI";

now segment() is behaving


problem retrieving uri segments using $this->uri->segment() - El Forum - 01-07-2011

[eluser]Cristian Gilè[/eluser]
If you are using re-reouted URI you have to use:

Code:
$this->uri->rsegment(n)

not

Code:
$this->uri->segment(n)

URI class is not compatible with QUERY_STRING