[eluser]riwakawd[/eluser]
[quote author="DavidZB" date="1232175221"]I found a way to allow more than one or two subfolders in the controllers folder. It was easy, and allows all of the normal functionality, even the method's params.... But i had to doit on the very same Router.php library.... anyway, if you want, is better to save a copy from your original Router.php class before testing this code.... here it goes:
In CodeIgniter 1.7.0, in the Router.php library, in the
Code:
_validate_request($segments)
function around line 205-207 there's the next code:
Code:
// Set the directory and remove it from the segment array
$this->set_directory($segments[0]);
$segments = array_slice($segments, 1);
Just after that code, insert the next lines:
Code:
//----------- NEW CODE ------------
while(is_dir(APPPATH.'controllers/'.$this->directory.$segments[0]) && count($segments) > 0){
// Set the directory and remove it from the segment array
$this->set_directory($this->directory . $segments[0]);
$segments = array_slice($segments, 1);
}
//----------- END OF NEW CODE ------------
so at the end, it should look like this:
Code:
// Set the directory and remove it from the segment array
$this->set_directory($segments[0]);
$segments = array_slice($segments, 1);
//----------- NEW CODE ------------
while(is_dir(APPPATH.'controllers/'.$this->directory.$segments[0]) && count($segments) > 0){
// Set the directory and remove it from the segment array
$this->set_directory($this->directory . $segments[0]);
$segments = array_slice($segments, 1);
}
//----------- END OF NEW CODE ------------
After this, everything is just normal. Save and test. You'll find this very usefull (it was for me). I hope this functionality to be inside the next CodeIgniter's version, jeje.
PD1: Sorry about my english. It isn't my natal language.
PD2: If this thread is already closed, it doesn't matter. I found this thread; someone else will find it too.[/quote]
Just seeing if you have new code for current codeigniter will it pick up it for default controller.