[eluser]Unknown[/eluser]
[quote author="CroNiX" date="1350679756"]create a helper or something.
/application/helpers/page_helper.php
Code:
function make_page($content = '')
{
//load CI instance
$CI =& get_instance();
//load header into a variable
$header = $CI->load->view('inc/header', null, TRUE);
//load footer into a variable
$footer = $CI->load->view('inc/footer', null, TRUE);
//output the header + content + footer
$CI->output->set_output($header . $content . $footer); //control/buffer output using CI's output class
}
in your controller:
Code:
//load the helper (autoload is better since you will use it all over)
$this->load->helper('page');
//only get the view for this page, as a variable
$content = $this->load->view('view_for_this_page', $data, TRUE);
// /application/views/view_for_this_page.php = '<h1>Hi</h1>'
//call your helper and pass it the content, and it will insert it between the reusable header/footer.
make_page($content);
[/quote]
Thanks will try this...