Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

44 lines (28 sloc) 1.482 kB

Use the :ref:`notification system <manual-notification>` from your templates.

This model makes it possible to user the power of the notifier mechanism inside your templates.


Send the message between the square brackets to the notifier system. The value of the first reaction is used. The order in which the modules are called is based on the priority of the modules.

When rendered the templates sends a notification with the message banner to all listeners, rendering the first reaction:

{{ m.notifier.first[`banner`] }}

A module would implement the following callback:

observe_banner(banner, _Context) ->
    <<"<h1>This is a banner</h1>">>.

Send the message between the brackets to the notifier message. All reactions are returned in a list. The order in which the modules are called is based on the priority of the module.

Here is an example of the use of map to insert footer navigation items. This works as follows. When the template is rendered the zotonic notifier is called with the message {footer_navigation, [{current_location=Id}]}. Zotonic modules can listen to this message and return this information. This can be very handy if you have to create dynamic interfaces based on what modules are enabled:

{% for item in[{footer_navigation current_location=id}] %}
    {% include "footer_item.tpl" item=item %}
{% endfor %}
Jump to Line
Something went wrong with that request. Please try again.