Raw Output

The output of {{{foo}}} or {{&foo}} will not be escaped by template engine.

Samples


lightncandy
Data:
array(
  "foo" => "Hello & Happy"
)
Template:
{{{foo}}}
Result:
Hello & Happy
Source Code
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);
handlebars.js
Data:
{
  "foo": "Hello & Happy"
}
Template:
{{{foo}}}
Result:
Hello & Happy
Source Code
var Handlebars = require('handlebars');
var template = '{{{foo}}}';

var render = Handlebars.compile(template);
var data = {
  "foo": "Hello & Happy"
};
console.log(render(data));
mustache
Data:
{
  "foo": "Hello & Happy"
}
Template:
{{{foo}}}
Result:
Hello & Happy
Source Code
var Mustache = require('mustache');
var template = '{{{foo}}}';

var data = {
  "foo": "Hello & Happy"
};
console.log(Mustache.render(template, data));

lightncandy
Data:
array(
  "foo" => "<p>Hello</p>"
)
Template:
{{&foo}}
Result:
<p>Hello</p>
Source Code
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);
handlebars.js
Data:
{
  "foo": "<p>Hello</p>"
}
Template:
{{&foo}}
Result:
<p>Hello</p>
Source Code
var Handlebars = require('handlebars');
var template = '{{&foo}}';

var render = Handlebars.compile(template);
var data = {
  "foo": "<p>Hello</p>"
};
console.log(render(data));
mustache
Data:
{
  "foo": "<p>Hello</p>"
}
Template:
{{&foo}}
Result:
<p>Hello</p>
Source Code
var Mustache = require('mustache');
var template = '{{&foo}}';

var data = {
  "foo": "<p>Hello</p>"
};
console.log(Mustache.render(template, data));