<?php
require_once('Mustache.php'); // Ensure feature/higher-order-sections branch !!
class MyMustache extends Mustache {
public function name()
{
return "Luke";
}
public function lambda()
{
$view = $this;
return function ($block) use ($view)
{
return '<strong>'.$view->render($block).'</strong>';
};
}
}
$m = new Mustache;
echo $m->render(
"{{#lambda}}{{name}}{{/lambda}}",
new MyMustache
);