Set Global Variables Codeigniter Set Global Variables Codeigniter codeigniter codeigniter

Set Global Variables Codeigniter


See CodeIgniter's documentation on $this->load->vars().

The documentation states:

This function takes an associative array as input and generates variables using the PHP extract function. This function produces the same result as using the second parameter of the $this->load->view() function. The reason you might want to use this function independently is if you would like to set some global variables in the constructor of your controller and have them become available in any view file loaded from any function. You can have multiple calls to this function. The data get cached and merged into one array for conversion to variables.