Welcome Guest, Not a member yet? Register   Sign In
Is it Bug or feature, having variables from parent view
#1

[eluser]fuksito[/eluser]
I found that in the view loaded from another view there is also variables from parent view. I don't want they to be there.
#2

[eluser]xwero[/eluser]
It's a feature. It allows you to do
Code:
$this->load->vars(array('site_name'=>'My site'));
$this->load->view('header');
// ...
$this->load->view('footer');
// the same without the vars method
$data['site_name'] = 'My site';
$this->load->view('header',$data);
// ...
$this->load->view('footer');
And in the view files you just echo $site_name without binding the variable to each view.

If you want to change this behavior you need to overwrite the _ci_load method of the loader class.
#3

[eluser]Chris Williams[/eluser]
That's clever! I didn't think of that.
#4

[eluser]fuksito[/eluser]
Dont you know if there are allready writed ?




Theme © iAndrew 2016 - Forum software by © MyBB