In Handlebars, you can make conditionals, like:
{{#if isActive}}
<img src="star.gif" alt="Active">
{{/if}}
http://handlebarsjs.com/block_helpers.html
I've been trying for a while to do something like this in the PHP Mustache. But nowhere i can find anything allowing {{#something withvalue }}
Why not just use the {{#each }} to if
something? If I want to Each over a list making li
s, and I only want to wrap them in a ul
when there are actually li
s?
I would need an extra value that has prechecked the list, which I think is ugly.
{{#hasList }}
<ul>
{{# list }}
<li>{{ title }}</li>
{{/ list }}
</ul>
{{/hasList }}
There must be a way to handle this in Mustache, right?