If I have the following array
array (
'people' => array(
[0] => array('name'=>'name1'),
[1] => array('name'=>'name2', 'last' => true)
)
);
and I want to output it using a Mustache template so that the final html looks like this:
<div>
Names: name1, name2
</div>
Though if the array is empty then it shouldn't output anything.
This is my current template
<div>
{{#people}}
Names: {{name}}{{^last}}, {{/last}}
{{/people}}
</div>
which outputs
<div>
Names: name1, Names: name2
</div>
I understand why it doesn't output what I want but I don't know how to solve it.