How to set default controller for sub-directory in controllers - 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: How to set default controller for sub-directory in controllers (/showthread.php?tid=43176) |
How to set default controller for sub-directory in controllers - El Forum - 07-03-2011 [eluser]gunnarflax[/eluser] Hi! I have a multilevel-directory structure of my controllers directory. The user guide says that this is fully possible, all I have to do is set a default controller for the sub-dir in the config. The thing is that there is only one key called 'default_controller' and I can't find anywhere how the extra default controller should be named. What should I call it? And how do I need to configure my routes? Thanks! How to set default controller for sub-directory in controllers - El Forum - 07-03-2011 [eluser]brucebat[/eluser] Would you not put the next parameter of default_controller in the controller you loaded. So that when the first controller is loaded it will then load another? How to set default controller for sub-directory in controllers - El Forum - 07-03-2011 [eluser]gunnarflax[/eluser] Don't think so. The default controller functions in the way that if the url doesn't contain any url-segment for the controller it loads the default one. So if my folder structure is like this: Code: -- controllers Code: http://www.example.com/ Code: $config['default_controller'] = 'home'; Code: http://www.example.com/subdir/ Code: http://www.example.com/subdir/admin/ How to set default controller for sub-directory in controllers - El Forum - 07-03-2011 [eluser]intractve[/eluser] I do this by... In routes.php Code: $route['subdir'] = 'subdir/admin'; How to set default controller for sub-directory in controllers - El Forum - 07-06-2011 [eluser]gunnarflax[/eluser] Thanks! That did wonders! How to set default controller for sub-directory in controllers - El Forum - 07-06-2011 [eluser]Caio[/eluser] [quote author="intractve" date="1309765818"]I do this by... In routes.php Code: $route['subdir'] = 'subdir/admin'; agreed! that always works best. |