Movatterモバイル変換


[0]ホーム

URL:


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');useLightnCandy\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');useLightnCandy\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...

Search the cookbook

Generated at 2022-03-21T13:13:56.019Z

[8]ページ先頭

©2009-2025 Movatter.jp