Welcome Guest, Not a member yet? Register   Sign In
constant variables accessable everywhere

Is there a place I can put a "config" file that holds a variables like time and client ID, so that every controller and function in the class has access to?

The project I'm working on is time sensitive and a global time must be the same across the site, and to make my life easier I wanted to create a global config area and not set the time in each function in every controller.


constant variable is kind of an oxy moron hehe :-P

application/constants.php holds pre-defined constants. Why not put your constants in there?

You can also create another php file in the aforementioned application/config directory. Then in your application/config/autoload.php you add your config file name to the $autoload['config'] array.

$autoload['config'] = array('config, another_config');
Use the name of your config file without the .php file extension.

-deleted duplicate post-

Thank you I didn't know about the constants.php file.

Theme © iAndrew 2016 - Forum software by © MyBB