Skip to content

Instantly share code, notes, and snippets.

@erikjung
Created March 30, 2012 07:17
Show Gist options
  • Save erikjung/2248503 to your computer and use it in GitHub Desktop.
Save erikjung/2248503 to your computer and use it in GitHub Desktop.
Using MustacheLoader class
<?php
include './../lib/mustache/Mustache.php';
include './../lib/mustache/MustacheLoader.php';
$template = <<<HTML
<body>
<header>{{header}}</header>
{{> partials/footer}}
</body>
HTML;
$data = array(
'header' => 'This is a header'
);
$mustache = new mustache;
$loader = new mustacheLoader('./../templates/', 'html');
echo $mustache->render($template, $data, $loader);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment