global variable codeigniter |
[eluser]italoc[/eluser]
i have a file with global variable that i have used for build my webapps now i have imported this webapp in CI but i would like to use the same global variable file. for example my file is written in this way: Code: $icon_add_category = $icon_folder."attach.gif"; there is a for use this variable as a global variable autoloaded withouth change the sintax? otherwise what can i do?? thanks..
[eluser]Dave Stewart[/eluser]
http://ellislab.com/codeigniter/user-gui...onfig.html I'm not CI expert (yet) but you could you extend the Controller class and have your now global variables be set as class/instance variables in the constructor? Then you subclass that Controller for all you other controllers. Hopefully there's an even cleaner way though.
[eluser]AgentPhoenix[/eluser]
You can always define a constant in the ./application/config/constant.php file that'll be available throughout your entire application. Code: define('ICON_ADD', $icon_folder . 'attach.gif'); Then anywhere in your application, you can just reference one of those constants when you need them.
[eluser]italoc[/eluser]
ok but in this way i need some setting in autoload? or this variable are loaded automaticaly? thanks... |
Welcome Guest, Not a member yet? Register Sign In |