How can I change the directory for the default module. I am using Zend Framework modular directory structure:
modules
default
controllers
IndexController.php
etc
other-module
But how can I change the directory for the default module? I would like it to be called Api. So I would have:
modules
Api
controllers
IndexController.php
other-module
I want the URIs to stay the same so:
http://localhost
Will route to modules/Api/controllers/IndexController.php and run the indexAction.
This is what I have in the bootstrap
protected function _initFrontController()
{
$front = Zend_Controller_Front::getInstance();
$front->addModuleDirectory(APPLICATION_PATH.'/modules');
return $front;
}
In
application/config.ini:Then you can remove the
_initFrontController()method from yourBootstrap.Note the character case here. Typically module names (as referenced in the config file and in routes) are lower-case. Also, the file name of the module will be lower-case (Ex:
application/modules/api). Module-specific class names (say, a controller within an admin module) will capitalize the first char of the module name as the class prefix (Ex:class Admin_ArticleController extends Zend_Controller_Action).[For hyphenated and camelCase module names – like your ‘other-module’ example – I forget precisely how module-specific classes should be prefixed, but it’s easy enough to chase down if you really need it.]