Welcome Guest, Not a member yet? Register   Sign In
Quick question on including data in view
#4

[eluser]cahva[/eluser]
Yes you can, but in your example $this->data['pagetitle'] is defined after $this->load->view('header') and is not available in header view. $pagetitle would be available in the footer view though because $this->data['pagetitle'] is defined before that. But remember to pass $this->data to other views also or use $this->load->vars($this->data) which will enable all the variables to all views without sending it separately. For example:
Code:
$data = array('foo' => 'Bar');

$this->load->vars($data);

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

Variable $foo would be available in all the views and you would not need to send the array separately to all views that need it. Like this:
Code:
$data = array('foo' => 'Bar');

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


Messages In This Thread
Quick question on including data in view - by El Forum - 12-08-2010, 03:33 PM
Quick question on including data in view - by El Forum - 12-09-2010, 02:31 AM
Quick question on including data in view - by El Forum - 12-09-2010, 09:36 AM
Quick question on including data in view - by El Forum - 12-09-2010, 04:02 PM



Theme © iAndrew 2016 - Forum software by © MyBB