[eluser]neilw[/eluser]
Hello,
In my code I need to use nested views. The solution I came up with is as follows: In the controller I dump all the data I need into an associative array then call a single view representing the whole page but made up of this data, e.g.
Code:
$this->load->view->('myview',$data);
I populate the $data from a selection of:
- model functions,
- from a view using the TRUE parameter
- from the template parser using the TRUE parameter
e.g.
Code:
$data['name']='bob';
$names=$this->mymodel->get_names();
$data['header']=$this->load->view('header','',TRUE);
$addresses=$this->load->view('partial',$names,TRUE);
$data['content']=$this->parser->parse('content',$addresses,TRUE);
$this->load->view('fullpage',$data);
On searching the forum I came across a technique that used $this->load->vars but I couldn't really figure it out and how it differed from my technique.
Can somebody explain what exactly load->vars is and how it differs from the method I described, or perhaps why my method is wrong. I'm kind of conscience that I'm storing a fair amount of data until the page is displayed and I could be doing it all wrong.
Many thanks.