• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
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!


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.