This is a basic example to use mustache or handlebars template.
$template = 'Hello, {{foo}}!';
var template = 'Hello, {{foo}}!';
var template = 'Hello, {{foo}}!';
$php = LightnCandy::compile($template);
$render = LightnCandy::prepare($php);
var render = Handlebars.compile(template);
Mustache.parse(template);
$data = array('foo' => 'world');
var data = {foo: 'world'};
var data = {foo: 'world'};
echo $render($data);
console.log(render(data));
console.log(Mustache.render(template, data));
echo $render($another_data);
console.log(render(another_data));
console.log(Mustache.render(template, another_data));
require('./vendor/autoload.php');
use LightnCandy\LightnCandy;
// Define the template
$template = 'Hello, {{foo}}!';
// Compile the template
$php = LightnCandy::compile($template);
$render = LightnCandy::prepare($php);
// Define the data
$data = array('foo' => 'world');
// Rendering the template
echo $render($data);
Hello, world!
var Handlebars = require('handlebars');
// Define the template
var template = 'Hello, {{foo}}!';
// Compile the template
var render = Handlebars.compile(template);
// Define the data
var data = {foo: 'world'};
// Rendering the template
console.log(render(data));
Hello, world!
var Mustache = require('mustache');
// Define the template
var template = 'Hello, {{foo}}!';
// Compile the template
Mustache.parse(template);
// Define the data
var data = {foo: 'world'};
// Rendering the template
console.log(Mustache.render(template, data));
Hello, world!