I'm using version 3 of codeigniter and inserting the concept of templates through the PARSER library, according to the CI's own documentation
It turns out that in version 2 I use a layout model through a Hook, as in this example:
In this last use was simpler because in Hook I already had the definition of which part of the block would the content of my view, ie making the includes of the static parts, like header, and rodape, changing only the body of the view.
In the parser case I still can not figure out how to make these static calls in a more usual way.
It would be something like:
class Home extends CI_Controller {
public function index() {
$data = array(
'blog_title' => 'My Blog Title',
'title' => 'My Title'
);
$row['nome'] = $this->session->userdata('nome');
$this->parser->parse('templates/cabecalho', $row);
$this->load->view('welcome_message');
$this->parser->parse('templates/rodape');
}
}
Would this be the best template for working with layouts using PARSER?