Closed joshpangell closed 11 years ago
thanks for the report. it's fixed now.
$h = new Handlebars_Engine;
echo $h->render(
'<div class="entry">
{{#if author}}
<h1>{{author.firstName}} {{author.lastName}}</h1>
{{else}}
<h1>Unknown Author</h1>
{{/if}}
</div>
',
array(
'author' => array(
'firstName' => "Charles",
'lastName' => "Jolley"
)
)
);
produces:
<div class="entry">
<h1>Charles Jolley</h1>
</div>
also
$h = new Handlebars_Engine;
echo $h->render(
'<div class="entry">
{{#if author}}
<h1>{{author.firstName}} {{author.lastName}}</h1>
{{else}}
<h1>Unknown Author</h1>
{{/if}}
</div>
',
array(
'author' => false
)
);
produces:
<div class="entry">
<h1>Unknown Author</h1>
</div>
A better way in ec6761fde447282d31fe4ac369f658159a09a259
The standard
if
else
block is not rendering properly. This example is strait from the Handlebars.js website.Output:
The
else
block is not being registered as a helper name. This can be parsed inside of theif
helper method, however, I am having troubles rendering the correct template source.Example: