Documentation

All Documentation

escapejson

Escapes the value for safe insertion into JSON strings.

escape_link

Convert any URLs in a plaintext into HTML links, with adding the rel="nofollow" attribute, and replaces all newlines…

escapexml

Escape the value for insertion in xml output.

event

Bind actions to a jQuery event or submit a form.

Events

postback trigger_event publish

exclude

Filters a list on the value of a property, either on absence or inequality.

Execute tasks asynchronously using the task queue

The Zotonic task queue lets applications perform tasks asynchronously.

Exometer metrics

Zotonic comes with a system for collecting and exporting metrics (such as how much memory is used, how many database…

extends

See also

extract

Extract a specific property from each item in a list.

facebook

Model for Facebook integration helpers, including auth-use flag, profile picture fetch, and Graph API proxy calls.

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…

filestore

The filestore uses two tables for its administration.

fileuploader

Model to start uploads, upload a block and delete uploads.

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.

filter_by

Filter a list of items based on a property value and optional predicate.

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.

floor

Round down a floating point value.

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_dispatch_controller_option

Format dispatch controller options.

format_dispatch_path_element

Format dispatch path element so variables will be more visible.

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

disable enable event focus form_reset reset set_value submit typeselect validation_error

Forms

pickle

Forms and validation

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

from_json

Parse a string as a JSON (JavaScript Object Notation) value. The returned value can be processed futher.

Frontend cookbook

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

Getting Started

You have three options for running Zotonic: to get started quickly, start our Zotonic container. You can also use Nix…

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…

hasedge

A validator to check if a resource has a certain number of edges with a predicate.

hide

Hide an element without any animation.

hierarchy

The category hierarchy tables have been replaced by m_hierarchy . This model defines named hierarchies of resources…

How to add a custom page block

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

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 render…

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

The m_identity model manages usernames and other user identities. mod_authentication uses it to store and check salted…

if

Selects an argument depending on a condition.

if

See also

ifchanged

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

ifequal

See also

ifnotequal

See also

if_undefined

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

image

See also

image_edit

Manages the medium_edit_settings property for non destructive image editing.

image_url

See also

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_data

Model to track resources imported from CSV and XLSX files.

Import/export notifications

import_csv_definition import_resource export_resource_content_disposition export_resource_content_type…

include

See also

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

See also

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…