Zend_Application is the big moma of the bootstrapping process. If you want to change you config file to an XML from the default INI you need to do it in Zend_Application. As an example, edit the Zend_Application instantiation in public/index.php to make as an XML.
public/index.php
// Create application, bootstrap, and run
$application = new Zend_Application(
APPLICATION_ENV,
APPLICATION_PATH . '/configs/application.XML'
);
$application = new Zend_Application(
APPLICATION_ENV,
APPLICATION_PATH . '/configs/application.XML'
);
Within __construct initialization of Zend_Application, Zend_Config class is called. You need to take a look at /Zend/Application.php->_loadConfig() to understand and from within the class depending upon the extension of your config file (for us its .XML) it will load Zend_Config_Xml or Zend_Config_Ini as default.
Back to the bootstrap process. We go back to Zend_Application as the resources from Zend_Config are initialized.
If you are pretty new to Zend Framework and looked at the default .ini file you might get overwhelmed on where in the world they refer all these resources and extra configurations. I was not able to find it quickly in the official ZF doc but here is the link http://framework.zend.com/manual/1.11/en/zend.application.core-functionality.html
In any case, I will mention the default options here. You can see all these in the source code of Zend_Application->setOptions(). Again i am talking about the application.ini file that is set through the bootstrap process.
//application.ini
phpsettings
includepaths
autoloadernamespaces
bootstrap There is also one configuration that you may wonder where it came from:
appnamespace = "Application"
The appnamespace is initialized when the Zend_Application_Bootstrap_BootstrapAbstract->_construct is run. it will proxy to setOptions() method and this will look for any setters within the Bootstrap class namespace and Zend_Aplication_Bootstrap_Bootstrap->setAppNamespace() will be initialized automatically.
You can also set your own options. Mine has the Smarty parameters:
smarty.layout_dir = APPLICATION_PATH "/layouts/scripts"
smarty.views_dir = APPLICATION_PATH "/modules/front/views/scripts"
smarty.dir = APPLICATION_PATH "/../library/My/Smarty"
smarty.template_dir = APPLICATION_PATH "/../tpl/templates"
smarty.compile_dir = APPLICATION_PATH "/../tpl/templates_c"
smarty.config_dir = APPLICATION_PATH "/../tpl/configs"
smarty.cache_dir = APPLICATION_PATH "/../tpl/cache"
smarty.caching = 0
smarty.compile_check = true
smarty.views_dir = APPLICATION_PATH "/modules/front/views/scripts"
smarty.dir = APPLICATION_PATH "/../library/My/Smarty"
smarty.template_dir = APPLICATION_PATH "/../tpl/templates"
smarty.compile_dir = APPLICATION_PATH "/../tpl/templates_c"
smarty.config_dir = APPLICATION_PATH "/../tpl/configs"
smarty.cache_dir = APPLICATION_PATH "/../tpl/cache"
smarty.caching = 0
smarty.compile_check = true
Resources:
You can get the available resources at http://framework.zend.com/manual/1.11/en/zend.application.available-resources.html
I wont list the resources because theres a bunch of them. If your unfamiliar with the syntax in config its something like:
resources.db.adapter = PDO_MYSQL
resources.db.params.host = 'localhost'
These resources are just proxying to Zend_Aplication_Resource_Db (notice the _Db at the end of the class) which then ports the Zend_Db::factory().
Heres the adapter reference: http://framework.zend.com/manual/1.11/en/zend.db.adapter.html
You can access all this config options in your bootstrap file via
// Bootstrap.php
$this->getOptions();
$this->getOptions();
You can also access your options and resources in the controllers:
// inside your controller
$bootstrapClass = $this->getInvokeArg('bootstrap');
$smartyConfig = $bootstrapClass->getOption('smarty');
// Database resource
$dbResource = $bootstrapClass->getResource('db');Thats about it for now