Actions

Template engine: Difference between revisions

From LimeSurvey Manual

(Created page with "Since Louis factored out all HTML from qanda and added a configuration file to the templates, it's a small task to add a template engine, replace the PHP views with e.g. Twig...")
 
No edit summary
Line 7: Line 7:
|-
|-
| Echo variable || <nowiki>{{var}}</nowiki> || <nowiki>{{var}}</nowiki>
| Echo variable || <nowiki>{{var}}</nowiki> || <nowiki>{{var}}</nowiki>
|-
| Echo field in variable || <nowiki>{{var.field}}</nowiki> || <nowiki>{{#var}} {{field}} {{/var}}</nowiki>
|-
|-
| Loop variable || {% for user in users %}  ... {% endfor %} || {{#users}} ... <nowiki>{{/users}}</nowiki>
| Loop variable || {% for user in users %}  ... {% endfor %} || {{#users}} ... <nowiki>{{/users}}</nowiki>
|}
|}

Revision as of 20:44, 11 September 2016

Since Louis factored out all HTML from qanda and added a configuration file to the templates, it's a small task to add a template engine, replace the PHP views with e.g. Twig templates.

Comparison between Twig and Mustache:

Function Twig Mustache
Echo variable {{var}} {{var}}
Echo field in variable {{var.field}} {{#var}} {{field}} {{/var}}
Loop variable {% for user in users %} ... {% endfor %} {{#users}} ... {{/users}}