How to create a Twig snippet plugin for server-side code

What is Twig and why use it?

Twig is a powerful HTML template engine. It offers all the features already available for the rich text editor, such as merge fields, along with other extras (e.g. conditional logic, loops, escaping strings).

Twig snippet plugin

The Twig snippet plugin allows to display a block of static HTML, Javascript or Twig code in a given slot. While PHP code will not be executed for security reasons, Zenario core functions can be used in a Twig snippet.


The following code will display the server time and timezone.

Twig snippet server time and timezone


Twig snippet server time and timezone result




Comments can be used to explain how a block of code works, mark different sections or any other reason.

These comments only appear in the source code and are never displayed to users.

To use a comment, put the {# ... #} tags around the text.

Twig snippet comment


Variables can be set using the {% set %} tag.

Twig snippet variable

These variables may later be used in conditional statements.


Twig supports looping over items in a sequence.

The following code will display all numbers 0-10 in one row:

Twig snippet numbers 0 to 10