Skip to content

Instantly share code, notes, and snippets.

@lukemorton
Forked from shadowhand/mustache-lambda.php
Created March 1, 2011 23:39
Show Gist options
  • Save lukemorton/850146 to your computer and use it in GitHub Desktop.
Save lukemorton/850146 to your computer and use it in GitHub Desktop.
<?php
require_once('MustacheLambda.php'); // Ensure feature/higher-order-sections branch !!
class MyMustache extends Mustache {
public function name()
{
return "Luke";
}
public function lambda()
{
return array($this, '_lambda');
}
protected function _lambda($inner)
{
return '<strong>'.$this->render($inner).'</strong>';
}
}
$m = new Mustache;
echo $m->render(
"{{#lambda}}{{name}}{{/lambda}}",
new MyMustache
);
@aqlx86
Copy link

aqlx86 commented Mar 2, 2011

thanks :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment