CodeIgniter Forums
Where to declare an application-wide variable? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21)
+--- Thread: Where to declare an application-wide variable? (/showthread.php?tid=27541)



Where to declare an application-wide variable? - El Forum - 02-13-2010

[eluser]behdesign[/eluser]
I want to declare a variable that will be used throughout the application (namely, a $SITE_ID variable that gets pulled from the db from the base_url). Where is the best place to do that in the cascade? Thanks!


Where to declare an application-wide variable? - El Forum - 02-14-2010

[eluser]Cro_Crx[/eluser]
Any constants that aren't going to be modified can be specified in constants.php. If you wish to store config variables in a database, you can read them in using the config class http://ellislab.com/codeigniter/user-guide/libraries/config.html


Where to declare an application-wide variable? - El Forum - 02-14-2010

[eluser]pdxbenjamin[/eluser]
Check out my previous thread.
http://ellislab.com/forums/viewthread/142718/


Where to declare an application-wide variable? - El Forum - 02-14-2010

[eluser]jedd[/eluser]
[quote author="behdesign" date="1266143814"]
... a $SITE_ID variable that gets pulled from the db from the base_url ...
[/quote]

Where does it get pulled from?