Documentation

All Documentation

export_resource_visible

mod_export - Check if the resource or dispatch is visible for export.

extends

Inherit markup from another template.

fade_in

Show an element by animating the opacity.

fade_out

Hide an element by animating the opacity.

filesizeformat

This filter formats a numeric value as KB, MB etc. This filter can be used to display a number of bytes in a human…

filewatcher

Broadcast some file changed, used for livereload by mod_development

filter

Filters a list on the value of a property, either on presence or equality.

filter

Filter the contents of a block through variable filters.

Filter and convert characters

Applying Erlang Binary syntax to get fast character manipulation.

first

Returns the first character or element.

firstof

Not implemented, but exists in Zotonic for forward compatibility with future ErlyDTL and Django versions.

fix_ampersands

Replaces ampersands in the value with “&” entities.

flatten_value

Flatten a list to a comma separated string.

focus

Add a $(..).focus() jQuery call to the target element to give it input focus.

for

Loop over multiple values in a list or search result.

force_escape

HTML escapes a text.

format

Regular expression test.

format_duration

Show a duration in hours, minutes and seconds.

format_integer

Show an integer value.

format_number

Show an integer or float.

format_price

Show a price with decimals.

form_reset

Resets the target form to its initial state.

Forms

pickle

Forms

disable enable event focus form_reset reset set_value submit typeselect validation_error

Forms and validation

You should validate all input data entered in forms. In Zotonic you create forms by writing plain HTML. You can attach…

Frontend cookbook

These cookbook entries contain valuable nuggets of information regarding the frontend development of a site.

Getting Started

You have two options for running Zotonic: to get started quickly, start our Zotonic container. Or you can install…

Global configuration

This section describes the location and contents of Zotonic’s global configuration files erlang.config and zotonic.

Global template variables

These variables are always available for rendering in templates.

Glossary

Action An action is functionality that can be attached to a HTML element or event. Actions are wired to an element or…

google_chart

Make charts with Google.

gravatar_code

Calculate the gravatar code for an e-mail address:

group_by

Groups items of a list by a property.

group_firstchar

Group a list of sorted resource ids on their first letter of the title or another rsc property. After grouping, it…

group_title_firstchar

Similar to group_firstchar, but always uses the title column from the rsc table.

growl

Show a message in the upper right corner of the browser window. The message will automatically disappear after some…

hide

Hide an element without any animation.

hierarchy_updated

Signal that the hierarchy underneath a resource has been changed by mod_menu

How to add a custom Content Block

Zotonic comes with a number of standard content blocks: Header, Text and Embed page. Additional content blocks are…

How to customise error pages

Specific error pages Zotonic’s controller_http_error first tries to find an error page template that is specific for…

HTML

show_media striptags truncate_html sanitize_html sanitize_url urlize embedded_media without_embedded_media…

http_log_access

Access log event for http. Called from the z_stats.

HTTPS support

Zotonic has built-in support for HTTPS and TLS (previously SSL) certificate handling.

Icons

Including Zotonic icons CSS Add the CSS file to your template:

Icons in templates

Zotonic provides a couple of ways to show icons in templates:

identity_password_match

Notification that a user’s identity has been verified.

identity_verification

Request to send a verification to the user. Return ok or an error Identity may be undefined, or is a identity used for…

identity_verified

Notification that a user’s identity has been verified.

if

Selects an argument depending on a condition.

if

Show a block if the condition is true.

ifchanged

Not implemented, but exists in Zotonic for forward compatibility with future ErlyDTL and Django versions.

ifequal

Show a block when two values are equal.

ifnotequal

Show a block when two values are not equal.

if_undefined

Tests whether a value is undefined, returning the given argument.

image

Show a still image using an <img> element. The image will be automatically resized to the desired size and filters. For…

image_data_url

Generate a data: url of a still image.

image_url

Generate the url of a still image.

Implementing a simple contact form

This tutorial teaches you to create a form, validate it, submit it over Ajax and e-mail the results back to you.

import_csv_definition

Find an import definition for a CSV file by checking the filename of the to be imported file.

Import/export notifications

import_csv_definition import_resource export_resource_content_disposition export_resource_content_type…

import_resource

An external feed delivered a resource. First handler can import it. Return:: {ok, m_rsc:resource_id()} , {error

include

Include another template. The include tag is replaced with the contents of the included template file. You can give…

index_of

Returns the index of the first occurrence of the item in the given list.

in_future

Tests if a date is in the future.

inherit

Include the markup of an extended template into the extending template.

inject_recipientdetails

Adds recipient query string details to hyperlinks.

in_past

Tests if a date is in the past.

inplace_textbox

Render a JS-aided inplace textbox.

insert

Prepends the argument in front of the value.

insert_after

Insert the result of a render action after of an HTML element.

insert_before

Insert the result of a render action before an HTML element.

insert_bottom

Inserts HTML after the contents of an HTML element.

insert_top

Inserts HTML before the contents of an HTML element.

Installation requirements

Zotonic runs on Linux, Mac OS X and (not officially) on Windows.

Introduction

This is the Zotonic Developer Guide. It takes you through all aspects of Zotonic so you can start building your own…

ip2country

Maps an IP address to a country using the MaxMind GeoIP2 database.

ip2geo

Maps an IP address to information about that country.

is_a

Filter a list of resource ids on category, or test if a single resource id belongs to a category.

is_defined

Tests if a value is defined.

is_even

Test if an integer value is even:

is_letsencrypt_valid_hostname

Test if a hostname can be used for a Let’s Encrypt certificate.

is_list

Test if a value is a list:

is_not_a

is_not_a mirrors is_a. It is particularly useful when iterating over a category and excluding members of a sub-category…

is_number

Test if a value is a number (integer or floating point):

is_rtl

Check if the given language is a rtl or ltr language.

is_site_url

Test if the given URL is a url for the current site.

Issues and features

If you encounter any issues in using Zotonic, or have ideas for new features, please let us know at the Zotonic issue…

is_undefined

Tests if a value is undefined.

is_visible

Filter a list of resource ids so that only the visible ids remain.

javascript

Adds javascript that will be run after jQuery has been initialized. In dynamic content it will run after the DOM has…

join

Joins the elements of a list. Joins the elements of the input list together, separated by the argument.

jquery_effect

Trigger various jQuery effects on the target element. Mostly, each of these effects have their own action as a shortcut

Just enough…

These Cookbook items each represent a stage in some Zotonic users’ journeys to understand the workings of Erlang and…

Just enough Erlang/OTP and rebar, part 1

Zotonic source code have you scratching your head? Learn Rebar first.

Just enough Erlang/OTP and rebar, part 2

Building a gen_server to front the library and generating documentation.

Just enough Erlang shell

An indispensible tool for both learning and programming Erlang.

Just enough Postgres

Understand the primary data-store of Zotonic.

Just Enough Regular Expressions (in Erlang)

Learn how to manipulate string data with the re module.