Documentation

All Documentation

controller_admin_backup_revision

Shows the admin backup revisions screen where you can see older version for a resource.

controller_admin_category_sorter

Shows the admin category screen where you can edit the category tree, rearranging the categories, adding new categories

controller_admin_comments

Shows an admin screen with an overview of most recently created comments. The screen offers the option to moderate the…

controller_admin_comments_settings

Shows an admin settings screen where you can edit settings related to mod_comment.

controller_admin_config

Shows the admin config editor. Here you can edit the key/value pairs of m_config.

controller_admin_edit

The main admin edit controller. This controller serves the edit page where resources can be edited.

controller_admin_mailinglist

This controller shows the mailing lists that are available in the system.

controller_admin_mailinglist_recipients

Shows the recipients of the current mailing list. The recipients are listed in three columns, and have a checkbox next…

controller_admin_mailing_preview

This controller shows a preview of what a resource that is being mailed would look like, in a popup window.

controller_admin_mailing_status

This controller shows the mailing status of a resource. It lists each mailing list available in the system, and shows…

controller_admin_media_preview

A controller for rendering preview thumbnails of any media embedded in a richtext-editor component of a resource on the…

controller_admin_module_manager

Shows the list of Zotonic modules currently known to the system.

controller_admin_referrers

Shows the list of pages ( resources) which refer to this resource through an edge.

controller_admin_seo

Shows a form with settings related to Search Engine Optimization.

controller_api

controler_api processes authorized REST API requests: It provides an easy way to create API calls to allow computer…

controller_authentication

This controller manages all authentication cookies. It is called by the auth model in the browser.

controller_file

Serve an uploaded-, resized- or library file.

controller_file_id

Redirect to the controller controller_file.

controller_fileuploader

The fileuploader controller is used to upload parts of a file.

controller_hello_world

Simple controller that always serves the string Hello, World!

controller_http_error

This controller is called for serving http error pages.

controller_id

Handle different content representations of a page.

controller_language_set

Controller which sets the language as given in the code argument, and redirects the user back to the page given in the…

controller_logoff

Controller that logs off a user, destroying the session. It also removes any “remember me” cookies the user has, so…

controller_logon_done

This controller is used as a jumping stone after a log on from the /logon page. The p argument is passed from the…

controller_mailinglist_export

Controller which downloads the given mailinglist id as a CSV file.

controller_mqtt_transport

Controller for transport of MQTT data between the browser (client) and server.

controller_page

Show a rsc as a HTML page.

controller_ping

Simple controller for connection tests, used on the /test/connection page.

controller_redirect

Redirect to another url.

Controllers

Controllers are the Erlang modules which decide what happens when a browser requests a page. Zotonic looks at the…

controller_signup

Controller which displays a form to sign up (rendered from signup.tpl ).

controller_signup_confirm

Controller which displays the confirmation page where the user can confirm his signup.

controller_static_pages

Serve a static page or pages.

controller_template

Show a template.

controller_website_redirect

This controller does a redirect to the website property of the given resource.

Cookbooks

Admin cookbook Creating a custom widget on the edit page Customizing the layout of the admin edit page Customizing the…

cors_headers

Set CORS headers on the HTTP response.

Create a custom controller

Zotonic comes with a large collection controllers that cover many use cases, so you’ll probably have to resort to…

Create a custom filter

Create custom template filters to change the way variables are rendered in your templates. By following some simple…

Create a custom model

In this chapter we will look at how to implement a model around the The Open Movie Database (OMDB) API.

Create a custom tag

Custom tags, internally called scomps , are module-defined tags, which are used when the logic is too complex to be…

Creating a custom widget on the edit page

Why For an imaginary webshop edit page, we want to add 2 more data fields: the affiliate URL and a note about free…

Creating sites

Initialize your site with a proper data model and some resources through manage_schema .

custom

Support for custom client-side (JavaScript-based) validators.

Customizing the layout of the admin edit page

Why After having created a custom widget (see Creating a custom widget on the edit page), we want to hide widgets that…

Customizing the sign up and sign in form

You want to change parts of the form, or change its appearance.

Customizing the style of an admin page

How to make style customizations to admin pages.

custom_pivot

Add custom pivot fields to a resource’s search index (map) Result is a single tuple or list of tuples {pivotname

Custom pivots

Search can only sort and filter on resources that actually have a database column. Zotonic’s resources are stored in a…

Custom search

Implement a custom search by observing the search_query notification in your module. Imagine you want to search cookies…

cycle

Rotate through a list of values.

date

Validate input date against a given date format.

date

Formats a date or datetime according to the format specified in the argument.

datediff

Calculate the difference between two dates, returning a single part of that difference.

date_range

Show a date range.

Dates

add_hour add_day add_month add_week add_year date date_range datediff eq_day in_future in_past ne_day sub_hour sub_day…

debug

Push some information to the debug page in the user-agent. Will be displayed with io_lib:format(“~p: ~p~n”, [What, Arg]…

debug

Shows which variables are assigned for use in the current template’s scope:

Debugging db (query) issues

Techniques for finding root cause when queries are involved.

debug_stream

Internal message of mod_development. Start a stream with debug information to the user agent. ‘target’ is the id of the…

default

Provide an alternative value in case a value has a falsy value (0, false , undefined or empty string).

delete_media

Delete a media file from a resource, without confirmation.

delete_rsc

Delete a resource, without confirmation.

delete_username

Delete the username from a user, no confirmation.

Deployment

So you have built your Zotonic site, and now you want to show it to the world. This page tells you how to configure…

Developer Guide

The technical handbook for developers building websites with Zotonic. It guides you through all aspects of the…

development

Dispatch rules Name Path Resource Args admin_development [“admin”,”development”] controller_admin [{template

dialog

Opens a dialog with a predefined HTML content and title.

dialog_close

Closes a dialog. When there is no dialog open then nothing happens.

dialog_config_delete

Open a dialog that asks confirmation to delete a configuration key/value pair.

dialog_config_edit

Open a dialog to edit a configuration key/value pair.

dialog_config_new

Open a dialog to create a new configuration key/value pair.

dialog_delete_rsc

Open a dialog to confirm the deletion of a resource.

dialog_delete_username

Open a dialog to confirm the deletion of the username of a user.

dialog_duplicate_rsc

Open a dialog to duplicate the current resource with a new id and title.

dialog_edit_basics

Open a dialog to edit the “basic” information of a resource.

dialog_mailing_page

Shows the dialog to mail the current page ( resource) to a mailing list. This is used in the admin “mailing status”…

dialog_mail_page

Shows the dialog to mail the current page ( resource) to a single e-mail address. This is used in the frontend of a…

dialog_media_upload

Shows the admin dialog for uploading a media item. See Media.

dialog_new_rsc

Show the admin dialog for creating a new resource.

dialog_open

Renders a template on the server and opens a dialog with the HTML output of the template.

dialog_predicate_new

Show a dialog for creating a new predicate.

Dialogs

dialog dialog_open dialog_close overlay_open overlay_close

dialog_set_username_password

Show a dialog for setting a username / password on the given resource (which is usually a person).

dialog_user_add

Show a dialog for adding a user. This creates a person resource and adds a username / password to it.

Directory structure

Zotonic is a set of regular OTP applications. These can be found in the repository’s apps/ directory: