07975 997026 enquiries@ harpanet.com
This first stage directs where ZF looks for its Models, Views and Controllers within a Modular structure.
Using application.ini method, edit your
application.ini file at
\wamp\www\PROJECT NAME\application\configs\application.ini (which in my case was
Add the following lines in the
resources.frontController.moduleDirectory = APPLICATION_PATH "/modules" resources.modules = ""
When using a Module based system with Zend Framework's default Routes, the module name needs to be included in the URL request in this format:
/module/controller/action. If the request doesn't contain the Module name, it looks in the 'default' location (ie.
/APPLICATION PATH/application/). The directive above tells ZF not to look in its usual default location but to look in the modules folder instead for a module called 'default'.
For this to work, we need to move all the 'default' folders over into our module folder:
Create a folder named
Move the existing default folders into the new default module
If this all works, you can use either
http://square.localhost/default/index/index to access the default application.
When defining custom routes within
application.ini, just remember to tell it which Module it needs to go to as well as the usual Controller and Action.
eg. a custom route to the homepage
; define the HOMEPAGE route resources.router.routes.home.route = /home resources.router.routes.home.defaults.module = default resources.router.routes.home.defaults.controller = index resources.router.routes.home.defaults.action = index