LightnCandy option: FLAG_THIS

Resolve {{this}} as {{.}} . Otherwise, {{this}} will lookup the variable 'this'.

Sample Codes

The default behavior: {{this}} will look for the value of 'this' key.

Used option: FLAG_JSOBJECT

Data:
array(
  "this" => "is good"
)
Template:
{{this}} == {{.}}
Result:
is good == [object Object]
Source Code
require('./vendor/autoload.php');
use LightnCandy\LightnCandy;
$template = "{{this}} == {{.}}";

$php = LightnCandy::compile($template, array(
  "flags" => LightnCandy::FLAG_JSOBJECT
));
$render = LightnCandy::prepare($php);
$data = array(
  "this" => "is good"
);
echo $render($data);

{{this}} means {{.}}

Used option: FLAG_JSOBJECT FLAG_THIS

Data:
array(
  "this" => "is good"
)
Template:
{{this}} == {{.}}
Result:
[object Object] == [object Object]
Source Code
require('./vendor/autoload.php');
use LightnCandy\LightnCandy;
$template = "{{this}} == {{.}}";

$php = LightnCandy::compile($template, array(
  "flags" => LightnCandy::FLAG_JSOBJECT | LightnCandy::FLAG_THIS
));
$render = LightnCandy::prepare($php);
$data = array(
  "this" => "is good"
);
echo $render($data);

See Also...