Skip to content

Instantly share code, notes, and snippets.

@shadowhand
Forked from lukemorton/mustache-lambda.php
Created March 1, 2011 23:30
Show Gist options
  • Save shadowhand/850129 to your computer and use it in GitHub Desktop.
Save shadowhand/850129 to your computer and use it in GitHub Desktop.
<?php
require_once('Mustache.php'); // Ensure feature/higher-order-sections branch !!
class MyMustache extends Mustache {
public function name()
{
return "Luke";
}
public function lambda($inner)
{
return '<strong>'.$this->render($inner).'</strong>';
}
}
$m = new Mustache;
echo $m->render(
"{{#lambda}}{{name}}{{/lambda}}",
new MyMustache
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment