Global Variable |
[eluser]jon74[/eluser]
Hi All, I am hoping to define a global variable in my controllers that can then be accessed from my Models and core files (e.g. DB_active_rec). I've tried using a constant, which works- but in certain scenarios I need to redefine the value within my controller which a constant doesn't support. I've also tried defining a global variable in the controller class, but it isn't available in the models/core files. Any pointers or suggestions would be greatly appreciated. Thanks
[eluser]alexwenzel[/eluser]
I use the config class for those cases. Code: $this->config->set_item('item_name', 'item_value'); After setting an config item anywhere in your application its global accessable. Code: $item_value = $this->config->item('item_name'); http://ellislab.com/codeigniter/user-gui...onfig.html |
Welcome Guest, Not a member yet? Register Sign In |