Documentation

All Documentation

acceptance

Check if an input value evaluates to true.

Access control

Access control is about defining who is allowed to access certain resources. It takes two steps:

acl_collab_groups_modify

Modify the list of collaboration groups of a user. Called internally by the ACL modules when fetching the list of…

acl_context_authenticated

Set the context to a typical authenticated user. Used by m_acl.erl

acl_is_allowed

Check if a user is authorized to perform an operation on a an object (some resource or module). Observe this…

acl_is_allowed_prop

Check if a user is authorizded to perform an action on a property. Defaults to true .

acl_is_owner

Check if a user is the owner of a resource. id is the resource id.

acl_logoff

Clear the associated access policy for the context.

acl_logon

Initialize context with the access policy for the user.

acl_mqtt

MQTT acl check, called via the normal acl notifications. Actions for these checks: subscribe, publish

ACL notifications

acl_context_authenticated acl_is_allowed acl_is_allowed_prop acl_is_owner acl_logoff acl_logon acl_mqtt acl_user_groups…

ACL options

Authorization checks to perform, in addition to the acl_action dispatch option, can be given in the acl dispatch option

acl_user_groups

Return the groups for the current user.

acl_user_groups_modify

Modify the list of user groups of a user. Called internally by the ACL modules when fetching the list of user groups a…

action_event_type

Render the javascript for a custom action event type. The custom event type must be a tuple, for example: {% wire…

Actions

with_args

Activate/deactivate modules

Rescuing a dysfunctional site from the Zotonic shell.

activity

An activity in Zotonic. When this is handled as a notification then return a list of patterns matching this activity.

activity_send

Push a list of activities via a ‘channel’ (eg ‘email’) to a recipient. The activities are a list of #activity{} records.

add_class

Add a css class to an html element.

add_day

Adds a day to a date. The value must be of the form {{Y,M,D},{H,I,S}} .

add_hour

Adds an hour to a date. The value must be of the form {{Y,M,D},{H,I,S}} .

add_month

Adds a month to a date. The value must be of the form {{Y,M,D},{H,I,S}} .

add_week

Adds a week to a date. The value must be of the form {{Y,M,D},{H,I,S}} .

add_year

Adds a year to a date. The value must be of the form {{Y,M,D},{H,I,S}} .

Admin

admin_tasks redirect_incat

Admin cookbook

Creating a custom widget on the edit page Customizing the layout of the admin edit page Customizing the style of an…

admin_dispatch

Dispatch rules Name Path Resource Args admin_user [“admin”,”users”] controller_admin [{template,”admin_users.tpl”}

admin_edit_blocks

Used in the admin to fetch the possible blocks for display

admin_menu

Used for fetching the menu in the admin.

admin_rscform

Used in the admin to process a submitted resource form

admin_tasks

Action module which provides postback handlers for the “status” view of the admin:

Admin template specific things

Common markup in admin templates.

after

Return the first element after another element in a list. For example:

alert

Show an alert dialog.

all catinclude

Include a template for all a resource’s categories from all modules.

All dispatch rules

All the dispatch rules from all modules. For a background on dispatch rules, see The URL dispatch system.

all include

Call all modules to include a certain template.

animate

Add a $(..).animate jQuery call to the target element.

append

Appends the argument to the value.

as_atom

Convert a value to an Erlang atom.

auth_checked

Fold over the context after logon of user with username, communicates valid or invalid password

auth_client_logon_user

Send a request to the client to login a user. The zotonic.auth.worker.js will send a request to…

auth_client_switch_user

Send a request to the client to switch users. The zotonic.auth.worker.js will send a request to…

auth_confirm

Confirm a user id.

auth_confirm_done

A user id has been confirmed.

Authentication notifications

auth_checked auth_confirm auth_confirm_done auth_client_logon_user auth_client_switch_user auth_logon auth_logoff…

auth_logoff

User is about to log off. Modify (if needed) the logoff request context.

auth_logon

User logs on. Add user-related properties to the logon request context.

auth_options_update

Update the given (accumulator) authentication options with the request options. Note that the request options are from…

auth_postcheck

First for logon of user with username, called after successful password check.

auth_precheck

First for logon of user with username, check for ratelimit, blocks etc.

auth_reset

First to check for password reset forms, return undefined, ok, or {error, Reason}.

auth_validate

First to validate a password. Return {ok, RscId} or {error, Reason}.

auth_validated

Authentication against some (external or internal) service was validated

autoescape

Automatically apply HTML escaping to values.

Automatically add new users to a user group

Why When you create a person, you usually need to add it to a user group as well. You may want to automate this, in…

Automatic startup on system boot

Once you have Zotonic running, you want to make sure that it automatically starts up when the server reboots, so that…

Backup

backup_start

backup

Dispatch rules Name Path Resource Args admin_backup [“admin”,”backup”] controller_admin_backup [seo_noindex]…

backup_start

Action which starts a manual backup.

before

Return the first element before another element in a list. For example:

Best Practices

Creating sites Media Best Practices Template Best Practices and Pitfalls

Binaries

first last length to_binary

block

Define a block in a template and overrules a block from an inherited template.

brlinebreaks

Translate HTML <br/> elements into ASCII newlines ( \n ).

Browser/server interaction

There are multiple ways to set up interaction between server-side Zotonic code and client-side JavaScript.

button

Makes a button with an action attached.

cache

Cache a frequently used block for later reuse.

call

Call an Erlang function.

capfirst

Converts the first character of the value to uppercase.

category_hierarchy_save

Save (and update) the complete category hierarchy

catinclude

Include another template based on the category of a resource. The include tag is replaced with the contents of the…

center

Centers the value in a field of a certain width using spaces.

Character escaping

brlinebreaks escape escape_check escape_ical escape_link escapejs escapejson escapexml fix_ampersands force_escape…

chart_pie

Show a pie chart.

chart_pie3d

Show a pie chart with 3D effect.

chunk

This filter splits a list in shorter lists. It splits an array in sub-arrays of at most a given length. This is useful…

CMS

Zotonic is a Content Management System (CMS).

Command-line

The zotonic command runs a number of utility commands which all operate on a Zotonic instance.

Command-line shell

The Zotonic shell gives you access to a running Zotonic instance with its code and data.

comment

Ignore part of a template.

comment_insert

Notification to signal an inserted comment. ‘comment_id’ is the id of the inserted comment, ‘id’ is the id of the…

Config

config_delete config_toggle dialog_config_delete dialog_config_edit dialog_config_new

config_delete

Trigger the deletion of a configuration value. Used in the admin.

config_toggle

Toggle a configuration value. Used in the admin, for instance when displaying a “live” checkbox the state of which…

Configuration

Global configuration Site configuration Port configurations

confirm

Show a JavaScript confirm message and on confirmation triggers one or more actions and/or sends a postback to the…

confirmation

Check if two inputs are the same.

content_types_dispatch

Get available content types and their dispatch rules Example: {“text/html”, page} A special dispatch rule is ‘page_url’

Contributing to Zotonic

We encourage contributions to Zotonic from the community! This chapter describes how you can help improve Zotonic.

controller_admin

The admin controller is the main controller behind which admin pages are served. Its main purpose is that it does an…

controller_admin_backup

Shows the admin backup screen where you can download nightly backups that were made by mod_backup.