I have a few constants that I’ll need to define for my application, for example, SITE_KEY which would contain a random key for salt passwords.
I’m not sure where I should define those, though. I thought of placing them in public/index.php but that seems a bit messy. Is there a specific place where they should go, according to Zend or something?
Thanks
EDIT
I’m trying to do it this way:
In my application.ini I have this:
siteglobal.sitekey = "test"
and in my bootstrap.php file:
protected function _initGlobals()
{
$config = $this->getOptions();
define('SITE_KEY', $config['siteglobal']['sitekey']);
}
Still, this isn’t working, when I try to echo SITE_KEY in my controller like this:
echo SITE_KEY;
It doesn’t show anything. Any ideas?
In my application, I’m combining both Haim’s and Yeroon’s approaches. I’m storing application constants in my
application.ini, then parsing them in theBootstrapand putting them intoZend_Registry.So, in the
application.iniIn the
BootstrapThen I can access these constants from any place in the application (model, controller, etc.)