The output of {{foo}}
will be escaped by template engine.
array(
"foo" => "Hello & Happy"
)
Hello & Happy
require('./vendor/autoload.php');
use LightnCandy\LightnCandy;
$template = "{{foo}}";
$php = LightnCandy::compile($template);
$render = LightnCandy::prepare($php);
$data = array(
"foo" => "Hello & Happy"
);
echo $render($data);
{
"foo": "Hello & Happy"
}
Hello & Happy
var Handlebars = require('handlebars');
var template = '{{foo}}';
var render = Handlebars.compile(template);
var data = {
"foo": "Hello & Happy"
};
console.log(render(data));
{
"foo": "Hello & Happy"
}
Hello & Happy
var Mustache = require('mustache');
var template = '{{foo}}';
var data = {
"foo": "Hello & Happy"
};
console.log(Mustache.render(template, data));
/
array(
"foo" => "<p>Hello</p>"
)
<p>Hello</p>
require('./vendor/autoload.php');
use LightnCandy\LightnCandy;
$template = "{{foo}}";
$php = LightnCandy::compile($template);
$render = LightnCandy::prepare($php);
$data = array(
"foo" => "<p>Hello</p>"
);
echo $render($data);
{
"foo": "<p>Hello</p>"
}
<p>Hello</p>
var Handlebars = require('handlebars');
var template = '{{foo}}';
var render = Handlebars.compile(template);
var data = {
"foo": "<p>Hello</p>"
};
console.log(render(data));
{
"foo": "<p>Hello</p>"
}
<p>Hello</p>
var Mustache = require('mustache');
var template = '{{foo}}';
var data = {
"foo": "<p>Hello</p>"
};
console.log(Mustache.render(template, data));
'
, `
and =
in his wayarray(
"foo" => "Quotes as ' and \" and ` , equal is ="
)
Quotes as ' and " and ` , equal is =
require('./vendor/autoload.php');
use LightnCandy\LightnCandy;
$template = "{{foo}}";
$php = LightnCandy::compile($template);
$render = LightnCandy::prepare($php);
$data = array(
"foo" => "Quotes as ' and \" and ` , equal is ="
);
echo $render($data);
{
"foo": "Quotes as ' and \" and ` , equal is ="
}
Quotes as ' and " and ` , equal is =
var Handlebars = require('handlebars');
var template = '{{foo}}';
var render = Handlebars.compile(template);
var data = {
"foo": "Quotes as ' and \" and ` , equal is ="
};
console.log(render(data));
{
"foo": "Quotes as ' and \" and ` , equal is ="
}
Quotes as ' and " and ` , equal is =
var Mustache = require('mustache');
var template = '{{foo}}';
var data = {
"foo": "Quotes as ' and \" and ` , equal is ="
};
console.log(Mustache.render(template, data));
Used option: FLAG_HBESCAPE
array(
"foo" => "Quotes as ' and \" and ` , equal is ="
)
Quotes as ' and " and ` , equal is =
require('./vendor/autoload.php');
use LightnCandy\LightnCandy;
$template = "{{foo}}";
$php = LightnCandy::compile($template, array(
"flags" => LightnCandy::FLAG_HBESCAPE
));
$render = LightnCandy::prepare($php);
$data = array(
"foo" => "Quotes as ' and \" and ` , equal is ="
);
echo $render($data);
{
"foo": "Quotes as ' and \" and ` , equal is ="
}
Quotes as ' and " and ` , equal is =
var Handlebars = require('handlebars');
var template = '{{foo}}';
var render = Handlebars.compile(template);
var data = {
"foo": "Quotes as ' and \" and ` , equal is ="
};
console.log(render(data));
{
"foo": "Quotes as ' and \" and ` , equal is ="
}
Quotes as ' and " and ` , equal is =
var Mustache = require('mustache');
var template = '{{foo}}';
var data = {
"foo": "Quotes as ' and \" and ` , equal is ="
};
console.log(Mustache.render(template, data));