Navigation

Zotonic tags are in general compatible with Django tags, though there
are some differences in which arguments are accepted. Not all Django
tags are implemented.

Zotonic also adds some new tags and Filters unknown to Django. For
example the tags image and translate.

The general syntax for a tag is the following:

{%tagnameparam1=valueparam2=value%}

Some tags are “block” tags and therefore consist of a start and an end
tag. The name of the end tag is always end plus the name of the
opening tag:

{%tag%} ...{%endtag%}

There are two different kinds of tags: builtin tags and custom
tags. The main difference between these is that custom tags can be
implemented by The module system, and builtin tags are implemented
inside the ErlyDTL template system.

Custom tags, internally called scomps, are module-defined tags,
which are used when including templates is not enough and more
programming is needed.

Custom tags add logic to templates or generate HTML/Javascript
constructs that are too difficult for templates. A good example is the
menu scomp which implements the menu, including sub menus
and highlighting of the current menu item.

Scomps have the same syntax as tags:

{%scompnamearg=value...%}.

For a full list of custom tags that ship with Zotonic, see:
Custom Tags.

After rendering a template it is inspected to find all scripts,
actions and validators. They are placed as #context records in the
resulting iolist, the #contexts should be replaced by the ‘render’
record-attribute. There will be a special ‘script’ atom to signify
the place where all collected scripts will be inserted. When the
script atom is not found, then the result of the template is a
context, unless there are no collected scripts.

Process state diagram, how all processes work together to render a scomp: