【发布时间】:2014-12-12 15:35:50
【问题描述】:
我正在使用 Mustache 2.7.0 并第一次尝试使用 Blocks pragma。
基本上,我称之为basic.mustache
{{< layout }}
{{$ title}}{{page.meta.name}}{{/ title}}
{{/ layout }}
调用块layout.mustache
<!DOCTYPE html>
<html>
<head></head>
<body>
<h1>{{$ title}}test{{/ title}}</h1>
</body>
</html>
我看到 page.meta.name 的值出现在页面上,但没有出现在 layout.mustache 中写的标签。
有人知道为什么吗?
PHP
$mustache = new Mustache_Engine(array(
'pragmas' => [Mustache_Engine::PRAGMA_BLOCKS],
'loader' => new Mustache_Loader_FilesystemLoader('htdocs/templates'),
'partials_loader' => new Mustache_Loader_FilesystemLoader('htdocs/templates/partials/')
));
$tpl = $mustache->loadTemplate('basic');
echo $tpl->render( $this );
【问题讨论】:
标签: mustache mustache.php