Welcome Guest, Not a member yet? Register   Sign In
the array from the controller into the view
#1

[eluser]rvent[/eluser]
Hello,

I am loading different views:

Code:
$this->load->view('header');
$this->load->view('content');
$this->load->view('footer');

Now i am know can do: $this->load->view('header', $data); and be able to use the data passed in my view, but do i have to do it on each view, or will the data be available to all view if i just do:

Code:
$this->load->view('header', $data);
$this->load->view('content', $data);
$this->load->view('footer', $data);

I would think you could just do:
Code:
$this->load->view('header', $data);
$this->load->view('content');
$this->load->view('footer');

And be ok using data in the other views..

Any ideas..?

Thanks
#2

[eluser]InsiteFX[/eluser]
Code:
// make data for all views!
$this->load->vars($data);

this->load->view('header');
$this->load->view('content');
$this->load->view('footer');

InsiteFX
#3

[eluser]rvent[/eluser]
oh snap, i forgot about vars...

Thanks!




Theme © iAndrew 2016 - Forum software by © MyBB