Daniel
Daniel

Reputation: 667

Zend Framework - access config file values from application.ini inside Bootstrap

I'm using Zend Framework 1.12, and I need to access a config value from application.ini inside an _initFunction from the Bootstrap.

Usually, I'd do the following inside the Controller:

$frontController = Zend_Controller_Front::getInstance();
$options = new Zend_Config($frontController->getParam('bootstrap')->getOptions(), true);
$language = $options->get('interface', false)->language;

However, inside the _initFunction this does not work.

I've tried using new Zend_Config($this->getOptions(), true); but it does not return any data.

Do you have any sollutions?

Thanks

Upvotes: 0

Views: 905

Answers (1)

Bruno Calza
Bruno Calza

Reputation: 2780

Here it is what might work for you:

$config = new Zend_Config_Ini(APPLICATION_PATH . '/configs/application.ini', APPLICATION_ENV);

APPLICATION_PATH and APPLICATION_ENV are constants defined on index.php

Upvotes: 2

Related Questions