Align boolean conversion logic with JavaScript.
The default behavior: true converts to 1, false converts to empty string.
array(
"foo" => true,
"bar" => false
), 1, require('./vendor/autoload.php');
use LightnCandy\LightnCandy;
$template = "{{foo}}, {{bar}}";
$php = LightnCandy::compile($template);
$render = LightnCandy::prepare($php);
$data = array(
"foo" => true,
"bar" => false
);
echo $render($data);
Same behavior with handlebars.js and mustache.js.
Used option: FLAG_JSTRUE
array(
"foo" => true,
"bar" => false
), true, falserequire('./vendor/autoload.php');
use LightnCandy\LightnCandy;
$template = "{{foo}}, {{bar}}";
$php = LightnCandy::compile($template, array(
"flags" => LightnCandy::FLAG_JSTRUE
));
$render = LightnCandy::prepare($php);
$data = array(
"foo" => true,
"bar" => false
);
echo $render($data);