Multiple controller sub folders - 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: Multiple controller sub folders (/showthread.php?tid=30962) |
Multiple controller sub folders - El Forum - 06-01-2010 [eluser]Timothy_[/eluser] Hello, My codeigniter site has grown rather large and i am in need of multiple sub folders for my controllers. I am already using one layer of sub folders successfully but get 404 errors if i add another 'level' of folders within my controller directory. So 'folder/controller.php' works and 'folder/folder/controller.php' throws a 404. In my searches i found a bug report describing this. Can someone please confirm that this is still the case. Thanks, Tim Multiple controller sub folders - El Forum - 06-01-2010 [eluser]Buso[/eluser] wow, I would like to see that site if that's not a problem Multiple controller sub folders - El Forum - 06-01-2010 [eluser]Timothy_[/eluser] Sure, I'll send you a link once we go live! Multiple controller sub folders - El Forum - 06-01-2010 [eluser]Buso[/eluser] I don't know about CI 1.72, but it doesn't work on CI 2.0, so I don't think it ever did You can try hacking or extending Router.php library, its human-readable Look for _validate_request method Multiple controller sub folders - El Forum - 06-02-2010 [eluser]mddd[/eluser] CodeIgniter doesn't support more than 1 level of folders out of the box. You could probably make it do so yourself, like Buso says. Multiple controller sub folders - El Forum - 06-02-2010 [eluser]Unknown[/eluser] Thanks to the advise of Buso, i made this change which seems to work and give you 1 (ONE) extra level or sub-folders. Have struggled add more levels, but this is all i need. So anyway, goto system/libraries/Router.php, goto line 211 (just below // Set the directory and remove it from the segment array) and insert this code Code: if(is_dir(APPPATH.'controllers/'.$segments[0].'/'.$segments[1])){ instead of this code Code: $this->set_directory($segments[0]); hope this helps someone! |