user396070
user396070

Reputation:

How can I load my mustache template with PHP?

index.php:

<!-- language: lang-php -->

require('v/Mustache/Autoloader.php');

Mustache_Autoloader::register();

$m = new Mustache_Engine(array(
    'loader' => new Mustache_Loader_FilesystemLoader(dirname(__FILE__) . '/v'),
));

// loads template from `v/sign_in.mustache` and renders it.
$m->render('sign_in', array('planet' => 'world'));

?>

v/sign_in.mustache:

<h1>Where in the {{planet}} is Carmen San Diego?</h1>

When I load index.php, I see a big blank screen with no errors.

Upvotes: 0

Views: 1820

Answers (1)

mpm
mpm

Reputation: 20155

echo $m->render('sign_in', array('planet' => 'world'));

Upvotes: 1

Related Questions