dq23171 2015-11-16 08:10
浏览 52

错误意外关闭标记:/内容在zend 2上的Mustache

I am using widmogrod/zf2-mustache-module "dev-master" with Zend framework 2 skeleton application

In layout I have this code:

{{$content}}{{/content}}

which should be replaced by actual content provided by each controller action

I receive this error:

Unexpected closing tag: /content in vendor/mustache/mustache/src/Mustache/Parser.php

It used to work on Zend framework 1 using phly/mustache "dev-master" https://github.com/phly/phly-mustache

How the content block should look like in layout, To be able to load Mustache correctly, With content replaced with the controller action's actual content ?

  • 写回答

1条回答 默认 最新

  • douluolan9101 2015-11-16 12:04
    关注

    In Mustache Configuration, Enable Blocks Pragma ,By Adding the following part :

    'pragmas' => array(
            Mustache_Engine::PRAGMA_BLOCKS
        ),
    'partials_loader' => array(
            dirname(__FILE__).'/../../layout', //directory for parent layout
            "extension" => ".phtml"
        )
    

    In layout, Use blocks pragma, By adding the following part at the top of the file :

    {{% BLOCKS }}
    

    In child template extending layout, Use blocks pragma, Expected to look like this :

    {{% BLOCKS }}
    {{< layout }}
    {{$ content }}
        <div >
             New Content
        </div>
    {{/ content }}
    {{/ layout }}
    

    Then, I needed to fix an issue in BLOCKS pragma usage available at https://github.com/lebaz20/zf2-mustache-module and requested pull for the main library at https://github.com/widmogrod/zf2-mustache-module/pull/9

    评论

报告相同问题?

悬赏问题

  • ¥15 三因素重复测量数据R语句编写,不存在交互作用
  • ¥15 微信会员卡等级和折扣规则
  • ¥15 微信公众平台自制会员卡可以通过收款码收款码收款进行自动积分吗
  • ¥15 随身WiFi网络灯亮但是没有网络,如何解决?
  • ¥15 gdf格式的脑电数据如何处理matlab
  • ¥20 重新写的代码替换了之后运行hbuliderx就这样了
  • ¥100 监控抖音用户作品更新可以微信公众号提醒
  • ¥15 UE5 如何可以不渲染HDRIBackdrop背景
  • ¥70 2048小游戏毕设项目
  • ¥20 mysql架构,按照姓名分表