Probably the most common resource you will load with
Zend_Application will be the Front Controller resource,
which provides the ability to configure
Zend_Controller_Front. This resource provides the ability
to set arbitrary front controller parameters, specify plugins to
initialize, and much more.
Once initialized, the resource assigns the $frontController
property of the bootstrap to the Zend_Controller_Front
instance.
Available configuration keys include the following, and are case insensitive:
controllerDirectory: either a string value specifying a single controller directory, or an array of module to controller directory pairs.
moduleControllerDirectoryName: a string value indicating the subdirectory under a module that contains controllers.
moduleDirectory: directory under which modules may be found.
defaultControllerName: base name of the default controller (normally "index").
defaultAction: base name of the default action (normally "index").
defaultModule: base name of the default module (normally "default").
baseUrl: explicit base URL to the application (normally auto-detected).
plugins: array of front controller plugin class names. The resource will instantiate each class (with no constructor arguments) and then register the instance with the front controller. If you want to register a plugin with a particular stack index, you need to provide an array with two keys class and stackIndex.
params: array of key to value pairs to register with the front controller.
returnresponse: whether or not to return the response object after dispatching the front controller. Value should be a boolean; by default, this is disabled.
If an unrecognized key is provided, it is registered as a front
controller parameter by passing it to setParam().
Example 34. Sample Front Controller resource configuration
Below is a sample INI snippet showing how to configure the front controller resource.
[production]
resources.frontController.controllerDirectory = APPLICATION_PATH "/controllers"
resources.frontController.moduleControllerDirectoryName = "actions"
resources.frontController.moduleDirectory = APPLICATION_PATH "/modules"
resources.frontController.defaultControllerName = "site"
resources.frontController.defaultAction = "home"
resources.frontController.defaultModule = "static"
resources.frontController.baseUrl = "/subdir"
resources.frontController.plugins.foo = "My_Plugin_Foo"
resources.frontController.plugins.bar = "My_Plugin_Bar"
resources.frontController.plugins.baz.class = "My_Plugin_Baz"
resources.frontController.plugins.baz.stackIndex = 123
resources.frontController.returnresponse = 1
resources.frontController.env = APPLICATION_ENV
; The following proxies to:
; Zend_Controller_Action_HelperBroker::addPath('Helper_Path', $helperPrefix);
resources.frontController.actionHelperPaths.HELPER_Prefix = "My/Helper/Path"
Example 35. Retrieving the Front Controller in your bootstrap
Once your Front Controller resource has been initialized, you can
fetch the Front Controller instance via the
$frontController property of your bootstrap.
<?php
$bootstrap->bootstrap('frontController');
$front = $bootstrap->frontController;




