CodeIgniter Forums
how to declare constant in ci? - 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: how to declare constant in ci? (/showthread.php?tid=31622)



how to declare constant in ci? - El Forum - 06-26-2010

[eluser]dhaulagiri[/eluser]
hello guys i want to put the site name as constant in my application, so that same contant will call site name throughout the site how do i do that ?


how to declare constant in ci? - El Forum - 06-26-2010

[eluser]Ajaxian64[/eluser]
in system/config/constants.php ?


how to declare constant in ci? - El Forum - 06-26-2010

[eluser]pickupman[/eluser]
You can use the file /application/config/constants.php to use define() there. I generally will start with a config file, and autoload it. Once the application is finished, I will then create a table with the values, and then create a simple settings controller. Then the end user has an easy way to change the variables dynamically.