CodeIgniter Forums
variable subdirectory - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21)
+--- Thread: variable subdirectory (/showthread.php?tid=22624)



variable subdirectory - El Forum - 09-15-2009

[eluser]Unknown[/eluser]
I didn't know how to make the title relevant so please read:

I have a "home" controller, and I want it to check the url for something like this
"index.php/home/variable", and then perform tasks based on the variable directory.

Is there a way to do this with codeigniter?


variable subdirectory - El Forum - 09-15-2009

[eluser]BrianDHall[/eluser]
Sure, use the URI Class Manual

Code:
$segs = $this->uri->segment_array();
var_dump($segs);

That will give you an idea of how that works, so in your constructor for instance you can check the segments for whatever you want and do whatever it is that you wanted to do.


variable subdirectory - El Forum - 09-15-2009

[eluser]Unknown[/eluser]
Thank you so much! It's much easier than I expected Smile


variable subdirectory - El Forum - 09-16-2009

[eluser]BrianDHall[/eluser]
You'll find you will say that a lot the more you use CI Smile