Hi Vincent,
This is how I managed to get it working.
extract from .ini
# Bootstrapping
bootstrap.path = APPLICATION_PATH "/Bootstrap.php"
bootstrap.class = "Bootstrap"
# Front Controller
resources.frontController.moduleDirectory = APPLICATION_PATH "/modules"
resources.frontController.defaultControllerName = "index"
resources.frontController.defaultAction = "index"
resources.frontController.defaultModule = "default"
resources.modules[] =
Bootstrap classes:
application/Bootstrap.php
class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
{
protected function _initHelpers()
{
$frontController = Zend_Controller_Front::getInstance();
$frontController->addModuleDirectory(APPLICATION_PATH.'/modules');
$modules = $frontController->getControllerDirectory();
foreach($modules as $name => $path) {
$autoloader = new Zend_Application_Module_Autoloader( array(
'namespace' => ucfirst($name).'_',
'basePath' => APPLICATION_PATH . "/modules/$name"
));
Zend_Controller_Action_HelperBroker::addPath($path, ucfirst($name) .
'_Helper');
}
}
}
application/modules/stats/Bootstrap.php
class Stats_Bootstrap extends Zend_Application_Module_Bootstrap
{
public function __construct($application)
{
parent::__construct($application);
}
}
If I recall, I was having the same issue as you, untill I added the
$frontController->addModuleDirectory(APPLICATION_PATH.'/modules'); into my
default bootstrap.
Hope this helps,
Karl
_____
From: Vadim Gabriel [mailto:[email protected]]
Sent: 07 May 2009 09:59 AM
To: Nabble Zend Framework General
Subject: [fw-general] Modules using zend_application
I was struggling with this, This entire morning with no luck at trying to
figure out how to setup a moduler structure and using zend_application and
bootstrapping. I have gone to a point where he scans the modules directory,
Does not load the bootstrap files located under each module directory root
and has the {modulename}_Bootstrap class name, It then tries to load the
controller named 'workshop' under the url http://localhost/workshop/public
which is clearly something it shouldn't do. And it does that until i add
'useDefaultControllerAlways' to the config file under the FrontController
resource. This is becoming very hard to understand as time goes by and the
ZF project grows bigger. I couldn't find any (good understanable organized)
documentation regarding this approach. If anyone tried anything like this or
has something to share, Please do. It's getting very agneying task to try
and create an application (with modules) using ZF b/c of the lack of
documentation for these issues.
Thanks.
--
Vincent Gabriel.
Lead Developer, Senior Support.
Zend Certified Engineer.
Zend Framework Certified Engineer.
-- http://www.vadimg.co.il/