[SOLVED] How to select default controller in subfolder? - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24) +--- Thread: [SOLVED] How to select default controller in subfolder? (/showthread.php?tid=64046) Pages:
1
2
|
[SOLVED] How to select default controller in subfolder? - normeno - 01-06-2016 Hi community, I'm trying to do a project in Codeigniter 3.x, but I have a question concerning the routes. If I have the following structure /application/controllers/Welcome.php I can put the following in routes.php and have no problem PHP Code: $ route ['default_controller'] = 'welcome'; The problem is that if I have the following structure /application/controllers/admin/Welcome.php I am not allowed to configure the routes so PHP Code: $ route ['default_controller'] = 'admin/welcome'; There is the ability to set default controller in a subdirectory of controllers? Thank you! RE: How to select default controller in subfolder? - Narf - 01-06-2016 No, you can't do that. RE: How to select default controller in subfolder? - Bhavesh - 01-06-2016 (01-06-2016, 05:08 PM)Narf Wrote: No, you can't do that. You can like /application/admin/[i]controllers/Welcome.php[/i] and than set default Am I right Narf? RE: How to select default controller in subfolder? - wolfgang1983 - 01-06-2016 (01-06-2016, 03:12 PM)normeno Wrote: Hi community, I have asked this question my self before you need to create a MY_Router.php file in application / core Default Controller In Sub Folder PHP Code: <?php RE: How to select default controller in subfolder? - Narf - 01-07-2016 (01-06-2016, 10:10 PM)Bhavesh Wrote:(01-06-2016, 05:08 PM)Narf Wrote: No, you can't do that. No. RE: How to select default controller in subfolder? - normeno - 01-07-2016 wolfgang1983 thanks for your help, I will review the class you mention. If this is not enabled by default for Codeigniter, what is the best way to separate environments? I was doing the following /application/controllers/admin/ /application/controllers/frontend/ /application/controllers/webservice/ RE: How to select default controller in subfolder? - mr_pablo - 01-08-2016 I have a similar setup. I have an "admin" sub-folder, and inside that, an index.php controller file that has an index method. Then you just add additional routing PHP Code: $route['admin'] = 'admin/index'; RE: How to select default controller in subfolder? - normeno - 01-08-2016 this has worked for me! (01-06-2016, 10:42 PM)wolfgang1983 Wrote:(01-06-2016, 03:12 PM)normeno Wrote: Hi community, RE: How to select default controller in subfolder? - wolfgang1983 - 01-08-2016 (01-08-2016, 07:47 AM)normeno Wrote: this has worked for me! There was to many quotes in you previous reply was hard to understand RE: How to select default controller in subfolder? - InsiteFX - 01-08-2016 It only pertains to the default controller, all other controllers in sub-folders will work with the route ( sub-folder/controller). |