Alex Rivera | Logout

Zend, Global variable in Application.ini?

Asked 2011-02-13T18:51:21.363
9

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,

Edit
Report

2 Answers

6

The best solution for me was to create a variable in index.php file. I have added: defined('VARIABLE_NAME') || define('VARIABLE_NAME', 'Something here');

And now I can access to it from everywhere ;D Thanks a lot!

answered 2011-02-14T21:54:05.307
0

I have a series of constants with the following naming convention in application.ini:

system.image_path  = "/assets/images"
system.custom_path = "/assets/custom"
system.cdn_URL     = "http://cdnurl.com"  

And I just reference them in my code as if they were PHP constants:

SYSTEM_IMAGE_PATH
SYSTEM_CUSTOM_PATH
SYSTEM_CDN_URL
answered 2013-06-27T17:49:42.513

Your Answer