如何在zf2中呈现Mustache Partial

时间:2015-03-25 01:55:33

标签: php zend-framework2 mustache.php

我正在使用此模块https://github.com/widmogrod/zf2-mustache-module

module.config

'strategies' => array(
    'Mustache\View\Strategy'
),

'template_map' => array(
    'My_Main' => __DIR__ . '/../view/main.phtml',
    'My_SideBar'  => __DIR__ . '/../view/partials/templates.mustache',
),

'mustache' => array(
    'partials_loader' => array(__DIR__ . '/../view/partials'),
),

templates.mustache

<div>
<p>Book Title: {{ title }}</p>
</div>

main.phtml视图

<?php 
echo $this->partial('My_SideBar', array('title' => 'My partial'));
?>

输出: 书名:{{title}}

0 个答案:

没有答案