views:

56

answers:

2

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)

+1  A: 

Use Zend Registry

// when loading the config
Zend_Registry::set('config', $config);
// later, somewhere
$config = Zend_Registry::get('config');
clyfe
does Front Controller has it in zendRegistry?
simple
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
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
From the bootstrap, isn't `$this->getOptions()` the array version of the application.ini?
gnarf
why would you duplicate my answer instead of comment ?
clyfe
sorry, when I started typing my answer there were none and I didn't noticed yours while typing mine
Laimoncijus