JoostV wrote:
> Totally new to Zend_Application, please forgive me for asking noob question
> like this.
> 
> When I instantiate a new application using Zend_Application I pass a
> config.ini file. I can accass the settings from this config file as an
> array, in Zend_Application_Bootstrap, using $this->getOptions(); 
> 
> However, I would like to access these settings as an object, as I'm used to
> from the 'old' $config = new Zend_Config_Ini('../application/config.ini',
> APPLICATION_ENV); method. How can I do this?


In you Bootstrap class (the one that extends
Zend_Application_Bootstrap_Bootstrap), add this method:


    protected function _initConfig()
    {
        $options = $this->getOptions();
        $config = new Zend_Config($options);
        Zend_Registry::set('config', $config);
        return $config;
    }


Just be aware that all top level keys are now lowercase, even if they
were mixed case in your application.ini file.

Regards,

Rob...

-- 
Rob Allen
Zend Framework Tutorial: http://akrabat.com/zft
Author of Zend Framework in Action: http://www.zendframeworkinaction.com

Reply via email to