Best way to enable Codeigniter view with Dwoo?

I use Codeigniter 1.7.2 and the great Phil Sturgeon Dwoo shell, which allows me to use the Dwoo template library in Codeigniter - http://philsturgeon.co.uk/code/codeigniter-dwoo

I have a small question regarding the inclusion of other view template files in the template files. Say, for example, I have a dashboard.php file and I want to include headers and footers, what is the best way to do this?

Usually I just did this:

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

And that seems to work, but the whole point of using a template library is to separate the code from my html. Can I use the Dwoo include functionality, and if so, how?

Update
Starting from the publication of this, I have developed all the features of Dwoo, you can include view files and use things like template inheritance to do the same thing, which is more neat than assigning views to variables. I do not recommend it later unless you really need to.

+3
source share
1 answer

I don't know about Dwoo, but you should be able to assign the parser output to a variable and pass this to your view:

$data_array['header'] = $this->parser->parse('header', $header_data, TRUE);

If you don’t need to parse your header / footer, just assign the output of the view to a variable and pass that into your template. The syntax is basically the same:

$data_array['header'] = $this->load->view('header', '', TRUE);

: http://codeigniter.com/user_guide/libraries/parser.html http://codeigniter.com/user_guide/general/views.html

, ( Dwoo wiki ), {$header} , , .

+10

Source: https://habr.com/ru/post/1754157/


All Articles