Reputation: 14815
I have 3 template files:
main.tpl
main_header.tpl
main_footer.tpl
I need to include the last 2 templates inside the first one using Mustache.php
I can't find documentation about it.
How can I do?
Upvotes: 3
Views: 942
Reputation: 5117
The included templates are called "partials" in Mustache. The tag to include them looks like this:
{{> main_header }}
{{> main_footer }}
You will need to set up a template loader so that Mustache can automatically load them.
Since your file extension is .tpl
, you should also let your template loader know.
The resulting code probably looks something like this:
<?php
$m = new Mustache_Engine(array(
'loader' => new Mustache_Loader_FilesystemLoader(
__DIR__.'/path/to/views',
array('extension' => '.tpl')
),
));
echo $m->render('main', $data);
Upvotes: 6