[eluser]CroNiX[/eluser]
I just create a library with a render_page() function.
Something like
Code:
//data is the data array which is passed to my "active" view, the one named in $view_file;
render_page($view_file, $data)
{
$this->load->view('header', array());
$this->load->view($view_file, $data);
$this->load->view('footer', array());
}
This is the most basic, because I am also loading other widgets, like login status, automatically here so I don't have to do it from my controllers.
then in my controllers...I just
Code:
//...do my stuff...
$data['something'] = $this->get_some_data();
$data['something_else'] = $this->some_model->get_even_more_data();
//...
//then
//...
$this->common_controller->render_page('admin/some_view_file', $data);
and everything else is done automatically. It leaves your controllers a lot cleaner because you aren't polluting them with "outside" code. Its only dealing with the specific thing it was designed to deal with.