0

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 ?

HaveNoDisplayName
  • 8,291
  • 106
  • 37
  • 47

1 Answers1

1

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