Actions

Template engine

From LimeSurvey Manual

Revision as of 20:55, 11 September 2016 by Olle (talk | contribs)

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}}
Branch on boolean {% if trueOrFalse %} ... {% endif %} {{#trueOfFalse}} ... {{/trueOrFalse}}
Translate Bind eT to lambda and then {{#eT}} "String to translate"" {{/eT}}