Enable named arguments support for partials and helpers.
Default is not supporting named arguments,
array(
"abc" => "NO",
"abc=123" => "YES"
)
!
OK=YES!
Check the code to know used helper codes
require('./vendor/autoload.php');
use LightnCandy\LightnCandy;
$template = "{{foo abc=123}}!";
$php = LightnCandy::compile($template, array(
"helpers" => array(
"foo" => function ($a) {
return "OK=$a";
}
)
));
$render = LightnCandy::prepare($php);
$data = array(
"abc" => "NO",
"abc=123" => "YES"
);
echo $render($data);
Default is not supporting named arguments,
Used option: FLAG_NAMEDARG
array(
"abc" => "NO",
"abc=123" => "YES"
)
!
OK=123!
Check the code to know used helper codes
require('./vendor/autoload.php');
use LightnCandy\LightnCandy;
$template = "{{foo abc=123}}!";
$php = LightnCandy::compile($template, array(
"flags" => LightnCandy::FLAG_NAMEDARG,
"helpers" => array(
"foo" => function ($option) {
return "OK={$option['hash']['abc']}";
}
)
));
$render = LightnCandy::prepare($php);
$data = array(
"abc" => "NO",
"abc=123" => "YES"
);
echo $render($data);