I have my controllers organized in subfolders, like this:
folder1/controller1
folder1/controller2
folder2/controller1
folder2/controller2
I need to get both the controller and the subfolder name, but right now I can only get the controller name using
$CI =& get_instance();
$CI->router->class;
I also tried this one:
$CI->uri->uri_string()
But if I call my controller with a method, it will return it too, like this
full url:
http://localhost/codeigniter/folder1/controller1/index
will return
folder1/controller1/index
instead of
folder1/controller1
I can do this by using the class name to remove the methods and arguments, but I want to know if there is a better solution.
Thanks in advance!
Here you have all the other goodies!
In you case you want
$this->router->directoryIt returns
folders/to/controller/with a trailing/.Example:
Adress: http://www.example.com/folder1/controller1
echo $this->router;Outputs:
folder1/