Reputation: 14145
Which approach would you recommend me to use in building "Layout" or "Master" page in CodeIgniter.
Should I create master page view like this
<div id="page">
<div id="header"><?php include "_header.php"?>
</div>
<div id="content"><?php echo $content ?>
</div>
<div id="footer">
<?php include "_footer.php"?>
</div>
</div>
_header.php
<?php echo $title ?>
and controller which sends data
function displayData()
{
$data['title'] = "some title";
$data['content'] = "content page";
$this->load->view('header');
$this->load->view('content', $data);
}
or you use some other technique, I'm coming from asp.net mvc world so I'm trying to grab fast as possible some tips.
Thanks
Upvotes: 2
Views: 278
Reputation: 172
Codeigniter has a layout library. You can access it here
https://github.com/EllisLab/CodeIgniter/wiki/layout-library.
Also, you can approach layouts in Codeigniter using hooks.
Upvotes: 1