Just need get some vals located in application.ini(main ini) in the Controller plugin I know I can create an instance of Zend_config_Ini but would like to use the existing resource (application.ini is already used in Front Controller)
views:
56answers:
2
+1
A:
Use Zend Registry
// when loading the config
Zend_Registry::set('config', $config);
// later, somewhere
$config = Zend_Registry::get('config');
clyfe
2010-03-11 11:06:04
does Front Controller has it in zendRegistry?
simple
2010-03-11 11:07:55
I assume you have an application.ini that you load in the bootstrap and feed it to front controller. You can add it to the registry there and fetch it later. Please provide more info if different.
clyfe
2010-03-11 11:11:44
A:
If you now that you will need your configuration values from application.ini
in few places around your whole application, you could read it up in bootstrap and store it in registry:
$appConfig = new Zend_Config_Ini('path/to/application.ini');
Zend_Registry::set('applicationConfig', $appConfig);
then later you can always access it:
Zend_Registry::get('applicationConfig')->someValue;
Laimoncijus
2010-03-11 11:08:44
From the bootstrap, isn't `$this->getOptions()` the array version of the application.ini?
gnarf
2010-03-11 11:13:06
sorry, when I started typing my answer there were none and I didn't noticed yours while typing mine
Laimoncijus
2010-03-11 12:43:27