Welcome Guest, Not a member yet? Register   Sign In
Global Variables for template system
#1

[eluser]Unknown[/eluser]
The problem:

I want to have a set of global variables so designers can easily put the variable in the template.
I want to be able to have Welcome user John Doe on every template page.
I use $this->load->view('template', $data) to load the template.


I have a model that is auto loaded the searches the session cookie to get the username.

thanks,
Carlos M
#2

[eluser]Unknown[/eluser]
I just made it a property of the main controller with
Code:
$CI =& get_instance();
$CI->foo = 12;
#3

[eluser]flaky[/eluser]
Code:
$data['user_name'] = "John Doe";
$this->load->vars($data);

//somewhere in the view
Hello <?php echo $user_name; ?>




Theme © iAndrew 2016 - Forum software by © MyBB