Closed cmoy closed 11 years ago
To fix this issue, I created a new array for the {{#each}}
helper. I edited the Helpers.php file in the method addDefaultHelpers() lines 90-107 shown below:
$this->add(
'each',
function ($template, $context, $args, $source) {
$tmp = $context->get($args);
$buffer = '';
if (is_array($tmp) || $tmp instanceof Traversable) {
foreach ($tmp as $var) {
if(!is_array($var)) {
$var = array("this" => $var);
}
$context->push($var);
$buffer .= $template->render($context);
$context->pop();
}
}
return $buffer;
}
);
For doing this, you can use {{.}} and not {{this}}
You can use this too.
As described on the http://handlebarsjs.com/ website.
when used with this context:
will result in:
Currently it'll iterate through but it does not render the content for {{this}}, instead it is left blank.