controllers can only have one level subfolder? |
[eluser]searain[/eluser]
I have read the posts in this forum about this issue. But it seems no definite answer. 1) as the default set up, controllers can only have one level subfolder, such as controllers/admin. Controllers cannot have more than 1 level subfolder, such as controllers/admin/products, controllers/admin/users etc., right? 2) but put all the admin controllers in controllers/admin is a little messy. All I want is that have two levels of subfolder such as controllers/admin/products, controllers/admin/events, and these will match the user interface controllers subfolders, /controllers/products, /controllers/events. 3) Is there an official (or good practice) approach to configure my CI allowing two level subfolders in controller? 4) Even there will be a lot of arguments that controllers should be only allow 1 level subfolders. I still think it would be good if CI by default at least allow 2 levels subfolders for controllers, in case we are working on a huge site. 2 levels may still not be enough but in most cases, two levels will do. Any ideas? Thanks a lot!
[eluser]tonanbarbarian[/eluser]
Not trying to be critical here but for me this would have been a good excuse to rummage around in the CI source code and determine for myself what was going on. Not only would I have found my answer for myself but I could have then passed that information on to others so that everyone else knows. 1. Yes only one subfolder. 2. If you want to simulate subfolders why not prefix your controllers with event_ or products_ etc 3. You could override the default router code and extend it to support multiple controller folders. this is not that hard a modification.
[eluser]jayrulez[/eluser]
[quote author="tonanbarbarian" date="1246348437"]Not trying to be critical here but for me this would have been a good excuse to rummage around in the CI source code and determine for myself what was going on. Not only would I have found my answer for myself but I could have then passed that information on to others so that everyone else knows. 1. Yes only one subfolder. 2. If you want to simulate subfolders why not prefix your controllers with event_ or products_ etc 3. You could override the default router code and extend it to support multiple controller folders. this is not that hard a modification.[/quote] true but thats alot more work than creating a new folder and just putting new files in it. i guess the person wants to go that route for organizational purposes
[eluser]wiredesignz[/eluser]
Maybe people should do a lot more work. If you can't read and understand the source code then you are severely disadvantaging yourself when trying to use this or any framework.
[eluser]searain[/eluser]
Thanks! http://ellislab.com/forums/viewthread/85554/ OK, I use DavidZB's code (clean and simple) to create MY_Router extends CI_Router (DavidZB directly modified the CI Router), it works so far.
[eluser]ntheorist[/eluser]
i just worked up a router extension that allows for deep controller subfolders (using a similar method as DZB), module folders and default controller method fallbacks (in generally that order). Let me know if that's what you're looking for. http://ellislab.com/forums/viewthread/123622/ cheers, n |
Welcome Guest, Not a member yet? Register Sign In |