Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Zend, Global variable in Application.ini?

I have a question as I need to have a global static variable and I have question is any possibility to add it to the application.ini file, how to do it?

Or I have to:

  1. Create abstract class with static variable,
  2. Register it in Zend_Registry to have access to this variable from all application (Register it in Bootstrap file)
  3. I can use it, or there is easier, I mean "automatic way" to do it?

Thanks for advice! Regars,

like image 894
canimbenim Avatar asked Feb 13 '11 18:02

canimbenim


1 Answers

in Application.ini file

someservice.apikey  = 12345678
someservice.passkey = 87654321

in bootstrap

public function _initSomeservice()
{
    $someservice = $this->getOption('someservice');
    Zend_Registry::set('someservice', $someservice);
}

to pull from Registry

$config = Zend_Registry::get('someservice');
like image 72
TuK Avatar answered Sep 28 '22 15:09

TuK