Application.ini with only $ this-> getOptions ()

I notice that $config = $this->getOptions();it only gets the default file application.inisettings. If I have additional ini files, how can I talk getOptionsabout them?

+3
source share
1 answer

You can combine the new parameters read from some user ini file into existing parameters in your Bootstrap.php as follows:

    $newOptions = new Zend_Config_Ini(APPLICATION_PATH . '/configs/newoptions.ini');        
    $this->setOptions($newOptions->toArray());

However, if you just want to read the user file and access it through your application, I would recommend storing it in Zend_Registry:

$newOptions = new Zend_Config_Ini(APPLICATION_PATH . '/configs/newoptions.ini');
Zend_Registry::set('newoptions', $newOptions);

When they are in the registry, you can always get them (for example, in your actions) simply by calling the get method:

$newOptions = Zend_Registry::get('newoptions');
+6
source

All Articles