Use {{foo}} will lookup the foo value from the input data.
array(
"foo" => "Hello"
)Hellorequire('./vendor/autoload.php');
use LightnCandy\LightnCandy;
$template = "{{foo}}";
$php = LightnCandy::compile($template);
$render = LightnCandy::prepare($php);
$data = array(
"foo" => "Hello"
);
echo $render($data);
{
"foo": "Hello"
}Hellovar Handlebars = require('handlebars');
var template = '{{foo}}';
var render = Handlebars.compile(template);
var data = {
"foo": "Hello"
};
console.log(render(data));
{
"foo": "Hello"
}Hellovar Mustache = require('mustache');
var template = '{{foo}}';
var data = {
"foo": "Hello"
};
console.log(Mustache.render(template, data));
array(
"bar" => "missing"
)require('./vendor/autoload.php');
use LightnCandy\LightnCandy;
$template = "{{foo}}";
$php = LightnCandy::compile($template);
$render = LightnCandy::prepare($php);
$data = array(
"bar" => "missing"
);
echo $render($data);
{
"bar": "missing"
}var Handlebars = require('handlebars');
var template = '{{foo}}';
var render = Handlebars.compile(template);
var data = {
"bar": "missing"
};
console.log(render(data));
{
"bar": "missing"
}var Mustache = require('mustache');
var template = '{{foo}}';
var data = {
"bar": "missing"
};
console.log(Mustache.render(template, data));
{{true}} will lookup on the key:true.array(
"true" => "World"
)Worldrequire('./vendor/autoload.php');
use LightnCandy\LightnCandy;
$template = "{{true}}";
$php = LightnCandy::compile($template);
$render = LightnCandy::prepare($php);
$data = array(
"true" => "World"
);
echo $render($data);
{
"true": "World"
}Worldvar Handlebars = require('handlebars');
var template = '{{true}}';
var render = Handlebars.compile(template);
var data = {
"true": "World"
};
console.log(render(data));
{
"true": "World"
}Worldvar Mustache = require('mustache');
var template = '{{true}}';
var data = {
"true": "World"
};
console.log(Mustache.render(template, data));
{{false}} will lookup on the key:false.array(
"false" => "Earth"
)Earthrequire('./vendor/autoload.php');
use LightnCandy\LightnCandy;
$template = "{{false}}";
$php = LightnCandy::compile($template);
$render = LightnCandy::prepare($php);
$data = array(
"false" => "Earth"
);
echo $render($data);
{
"false": "Earth"
}Earthvar Handlebars = require('handlebars');
var template = '{{false}}';
var render = Handlebars.compile(template);
var data = {
"false": "Earth"
};
console.log(render(data));
{
"false": "Earth"
}Earthvar Mustache = require('mustache');
var template = '{{false}}';
var data = {
"false": "Earth"
};
console.log(Mustache.render(template, data));
{{undefined}} will lookup on the key:undefined.array(
"undefined" => "Word"
)Wordrequire('./vendor/autoload.php');
use LightnCandy\LightnCandy;
$template = "{{undefined}}";
$php = LightnCandy::compile($template);
$render = LightnCandy::prepare($php);
$data = array(
"undefined" => "Word"
);
echo $render($data);
{
"undefined": "Word"
}Wordvar Handlebars = require('handlebars');
var template = '{{undefined}}';
var render = Handlebars.compile(template);
var data = {
"undefined": "Word"
};
console.log(render(data));
{
"undefined": "Word"
}Wordvar Mustache = require('mustache');
var template = '{{undefined}}';
var data = {
"undefined": "Word"
};
console.log(Mustache.render(template, data));
{{1}} will lookup on the second item.array(
"Hello",
"World"
)Worldrequire('./vendor/autoload.php');
use LightnCandy\LightnCandy;
$template = "{{1}}";
$php = LightnCandy::compile($template);
$render = LightnCandy::prepare($php);
$data = array(
"Hello",
"World"
);
echo $render($data);
[
"Hello",
"World"
]Worldvar Handlebars = require('handlebars');
var template = '{{1}}';
var render = Handlebars.compile(template);
var data = [
"Hello",
"World"
];
console.log(render(data));
[
"Hello",
"World"
]Worldvar Mustache = require('mustache');
var template = '{{1}}';
var data = [
"Hello",
"World"
];
console.log(Mustache.render(template, data));
array(
"foo" => "Good"
)Goodrequire('./vendor/autoload.php');
use LightnCandy\LightnCandy;
$template = "{{ foo }}";
$php = LightnCandy::compile($template);
$render = LightnCandy::prepare($php);
$data = array(
"foo" => "Good"
);
echo $render($data);
{
"foo": "Good"
}Goodvar Handlebars = require('handlebars');
var template = '{{ foo }}';
var render = Handlebars.compile(template);
var data = {
"foo": "Good"
};
console.log(render(data));
{
"foo": "Good"
}Goodvar Mustache = require('mustache');
var template = '{{ foo }}';
var data = {
"foo": "Good"
};
console.log(Mustache.render(template, data));
array(
"foo" => "Good"
)Goodrequire('./vendor/autoload.php');
use LightnCandy\LightnCandy;
$template = "{{\n foo\n\n}}\n";
$php = LightnCandy::compile($template);
$render = LightnCandy::prepare($php);
$data = array(
"foo" => "Good"
);
echo $render($data);
{
"foo": "Good"
}Goodvar Handlebars = require('handlebars');
var template = '{{\n foo\n\n}}\n';
var render = Handlebars.compile(template);
var data = {
"foo": "Good"
};
console.log(render(data));
{
"foo": "Good"
}Goodvar Mustache = require('mustache');
var template = '{{\n foo\n\n}}\n';
var data = {
"foo": "Good"
};
console.log(Mustache.render(template, data));