CodeIgniter Forums
Loading default views - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Loading default views (/showthread.php?tid=51665)



Loading default views - El Forum - 05-12-2012

[eluser]kezman[/eluser]
Hey everyone!
I have 10 controllers in my codeigniter web application.
I want to load header.php and footer.php views by default, but only in 8 cases.
Other 2 cases i want to load no view.

How can I do it?
Add

Code:
if($load_templates === TRUE)
{
   $this->load->view('header');
   $this->load->view('footer');
}

this code to
Code:
CI_Controller
constructor, and then call
Code:
parent::__construct($load_templates);
?


Loading default views - El Forum - 05-12-2012

[eluser]skunkbad[/eluser]
You could always use nested views. I have a main template that you embed other views in.


Loading default views - El Forum - 05-13-2012

[eluser]kezman[/eluser]
skunkbad, thanks. problem solved.