CodeIgniter Forums
uri segment problem - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: uri segment problem (/thread-51655.html)



uri segment problem - El Forum - 05-12-2012

[eluser]shujjat[/eluser]
hi

i am having problem with using uri segment.

in my app, i want to execute a code when $this->uri->segment(1) has a value. and another code when it is not provided.

i have written the code, but the condition when segment(1) is not provided is never being satisfied, have tried all possibilities...


need your time and suggestions... in a hurry !!! Sad


uri segment problem - El Forum - 05-12-2012

[eluser]vrencianz[/eluser]
If you take a look to http://ellislab.com/codeigniter/user-guide/libraries/uri.html you'll see that segment(1) is the controller name and segment(2) is the method name.

In a normal scenario segment(2) can be empty in which case it points to the controller's index() method and segment(1) when the controller is the default one (Default or set from config).