CodeIgniter Forums
how to define global variable use in whole site? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: how to define global variable use in whole site? (/showthread.php?tid=54584)



how to define global variable use in whole site? - El Forum - 09-15-2012

[eluser]Unknown[/eluser]
in the query i want to give table name from global array for use in whole site.


how to define global variable use in whole site? - El Forum - 09-15-2012

[eluser]Abdul Malik Ikhsan[/eluser]
Code:
$ci = & get_instance();
$ci->var = 'value';



how to define global variable use in whole site? - El Forum - 09-15-2012

[eluser]Unknown[/eluser]
from where i can define it i mean which file config.php or anywhere ?



how to define global variable use in whole site? - El Forum - 09-15-2012

[eluser]PhilTem[/eluser]
I'd suggest you put these kind of things in constants defined in ./application/config/constants.php so you can access them side wide.