CodeIgniter Forums
loading separated layout views - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Libraries & Helpers (https://forum.codeigniter.com/forum-22.html)
+--- Thread: loading separated layout views (/thread-40987.html)



loading separated layout views - El Forum - 04-25-2011

[eluser]Ngulo[/eluser]
hi , does anyone can suggest me the best way to separate layouts views such as:

header_view.php
footer_view.php
menu_view.php

into CI 2.0.2 ?


did you use some good structure to do that?


loading separated layout views - El Forum - 04-25-2011

[eluser]InsiteFX[/eluser]
Something like below, but you can also download template and layout libraries!

application/views/template.php
Code:
<?php $this->load->view('header');?>

<?php $this->load->view('nav');?>

<?php $this->load->view('content');?>

<?php $this->load-view('footer');?>

Controller:
Code:
$data = array();

    $data['title'] = 'Title';

    $this->load->vars($data);
    $this->load->view('template');

InsiteFX