Use {{foo}}
will lookup the foo
value from the input data.
array(
"foo" => "Hello"
)
Hello
require('./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"
}
Hello
var Handlebars = require('handlebars');
var template = '{{foo}}';
var render = Handlebars.compile(template);
var data = {
"foo": "Hello"
};
console.log(render(data));
{
"foo": "Hello"
}
Hello
var 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"
)
World
require('./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"
}
World
var Handlebars = require('handlebars');
var template = '{{true}}';
var render = Handlebars.compile(template);
var data = {
"true": "World"
};
console.log(render(data));
{
"true": "World"
}
World
var 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"
)
Earth
require('./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"
}
Earth
var Handlebars = require('handlebars');
var template = '{{false}}';
var render = Handlebars.compile(template);
var data = {
"false": "Earth"
};
console.log(render(data));
{
"false": "Earth"
}
Earth
var 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"
)
Word
require('./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"
}
Word
var Handlebars = require('handlebars');
var template = '{{undefined}}';
var render = Handlebars.compile(template);
var data = {
"undefined": "Word"
};
console.log(render(data));
{
"undefined": "Word"
}
Word
var 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"
)
World
require('./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"
]
World
var Handlebars = require('handlebars');
var template = '{{1}}';
var render = Handlebars.compile(template);
var data = [
"Hello",
"World"
];
console.log(render(data));
[
"Hello",
"World"
]
World
var Mustache = require('mustache');
var template = '{{1}}';
var data = [
"Hello",
"World"
];
console.log(Mustache.render(template, data));
array(
"foo" => "Good"
)
Good
require('./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"
}
Good
var Handlebars = require('handlebars');
var template = '{{ foo }}';
var render = Handlebars.compile(template);
var data = {
"foo": "Good"
};
console.log(render(data));
{
"foo": "Good"
}
Good
var Mustache = require('mustache');
var template = '{{ foo }}';
var data = {
"foo": "Good"
};
console.log(Mustache.render(template, data));
array(
"foo" => "Good"
)
Good
require('./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"
}
Good
var 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"
}
Good
var Mustache = require('mustache');
var template = '{{\n foo\n\n}}\n';
var data = {
"foo": "Good"
};
console.log(Mustache.render(template, data));