Zend_Application_Resource_ModulesZend_Application_Resource_Modules is used to initialize
your application modules. If your module has a
Bootstrap.php file in its root, and it contains a class
named Module_Bootstrap (where "Module" is the module name),
then it will use that class to bootstrap the module.
By default, an instance of
Zend_Application_Module_Autoloader will be created for the
module, using the module name and directory to initialize it.
Since the Modules resource does not take any arguments by default, in order to enable it
via configuration, you need to create it as an empty array. In INI style
configuration, this looks like:
In XML style configuration, this looks like:
]]>
Using a standard PHP array, simply create it as an empty array:
array(
'modules' => array(),
),
);
]]>Front Controller Resource Dependency
The Modules resource has a dependency on the Front
Controller resource. You can, of course, provide your own
replacement for that resource via a custom Front Controller resource
class or a class initializer method -- so long as the resource
plugin class ends in "Frontcontroller" or the initializer method is
named "_initFrontController" (case insensitive).
Configuring Modules
You can specify module-specific configuration using the module name
as a prefix or sub-section in your configuration file.
For example, let's assume that your application has a "news" module.
The following are INI and XML examples showing
configuration of resources in that module.
pdo_mysqllocalhostwebuserXXXXXXXnewstrue
]]>Retrieving a specific module bootstrap
On occasion, you may need to retrieve the bootstrap object for a
specific module -- perhaps to run discrete bootstrap methods, or to
fetch the autoloader in order to configure it. This can be done
using the Modules resource's getExecutedBootstraps()
method.
getPluginResource('modules');
$moduleBootstraps = $resource->getExecutedBootstraps();
$newsBootstrap = $moduleBootstraps['news'];
]]>