I am writing an app that have and admin module and default module.and i want to put all admin files like controllers and views in admin folder under application path and also default files in default folder. how can i achive this? this is the directory structure that it want
/application
/models
/default
/admin
I'd do something like the following.
Change your directory structure slightly (add a modules
level):
/application
/models
/modules
/default
/controllers
/models
/views
etc...
/admin
/controllers
/models
/views
etc...
Enable modules and tell the framework where to look for them; in application/config/application.ini
, add:
resources.modules[] = ""
resources.frontController.moduleDirectory = APPLICATION_PATH "/modules"
Detach the appnamespace
from the default module, forcing all module-specific code to be module-namespaced. In application/config/application.ini
, add:
resources.frontController.prefixDefaultModule = true
So, for example, a model in the default module would appear in file ./application/modules/default/models/MyModel.php
and would be named Default_Model_MyModel
.
Enable appnamespace for your top-level models, controllers, etc. In application/config/application.ini
:
appnamespace = "Application_"
So, a top-level model, to be usable by all modules, in the file ./application/models/MyModel.php
would be named Application_Model_MyModel
.
Not fully tested, but something along those lines ought to work.