Skip a delimiter when it behind \
.
The default behavior: \
do nothing
array(
"foo" => "OK"
)
Yes,
is \
Yes, OK is \OK
require('./vendor/autoload.php');
use LightnCandy\LightnCandy;
$template = "Yes, {{foo}} is \\{{foo}}";
$php = LightnCandy::compile($template);
$render = LightnCandy::prepare($php);
$data = array(
"foo" => "OK"
);
echo $render($data);
You can use this way to display {{
when you do not like to use \
array(
"foo" => "OK"
)
Show
in this way
Show {{ in this way
require('./vendor/autoload.php');
use LightnCandy\LightnCandy;
$template = "Show {{#with \"{{\"}}{{.}}{{/with}} in this way";
$php = LightnCandy::compile($template);
$render = LightnCandy::prepare($php);
$data = array(
"foo" => "OK"
);
echo $render($data);
Use \
to escape a delimiter
Used option: FLAG_SLASH
array(
"foo" => "OK"
)
Yes,
is \
Yes, OK is
require('./vendor/autoload.php');
use LightnCandy\LightnCandy;
$template = "Yes, {{foo}} is \\{{foo}}";
$php = LightnCandy::compile($template, array(
"flags" => LightnCandy::FLAG_SLASH
));
$render = LightnCandy::prepare($php);
$data = array(
"foo" => "OK"
);
echo $render($data);