Glossary

Action

An action is functionality that can be attached to a HTML element or event. Actions are wired to an element or event. Think of showing dialogs, posting forms, hiding elements etc.

See also Actions in the Developer Guide.

Category
The data model has a hierarchical tree for the categorization of resources. Every resource is part of one category. The categorization is used amongst others to decide which template to show when displaying a resource. A category is a resource of the category category. For more information, see Categories.
Context
The context is the current request context. It contains all the request data, the current site, the handle to the database and the results (scripts or templates) you will be sending back. The context is commonly passed along in Zotonic as the last argument of a function.
Controller
A controller is the main entry point where a request is handled. Controllers are referenced from a dispatch rule. Commonly used controller is controller_template, which serves a template on the URL for which the controller configured. See Controllers.
Data model
Zotonic’s generic data model of (categorized) resources which connect to other resources using labelled edges. This data model is loosely based on the principles of the semantic web.
Delegate
A reference to a module which will be used to call a callback function on. Used in the templates when attaching actions like a :term:postback to a DOM Event. See Actions.
Dispatch rule
A dispatch rule maps URL patterns to controllers. Dispatch rules are defined in files in the .dispatch. folder of a Zotonic module. The dispatch rule definitions are also used to generate the urls for resources and other pages. See Dispatch rules.
Domain model
A particular configuration of resource categories and predicates, which dictate how resources of certain categories relate to each other. For example, a blog-type site might need person, article and keyword categories, where persons and articles are connected using the author predicate to indicate article authorship, and articles might be connected to keywords with has_keyword predicates. See The Zotonic data model.
Edge
A resource can connecto to other resources. These connections are called edges. Edges contain no information other than where they are linked to and from, and what their predicate is. Edges have a single direction, from the subject to the object.
Erlang module
Not to be confused with a Zotonic module, an Erlang module is a single .erl file which contains Erlang functions.
Filter
A template mechanism which is used inside a template to transform data before it is output. For instance: the .lower. filter transforms its input to lowercase. Filters are implemented as Erlang modules, exporting a single filter function.
Media
Media are files, embed codes etc. They are attached to a resource. Every resource can hold a single medium. The resource is usually within the category media. See: Media.
Model
An Erlang module which is the main accessor for retrieving data. The Erlang modules are prefixed with m_; in the templates they are accessible using .m… For instance, the model to access resources is called m_rsc.erl; in the template this model lets you access resources by id as {{ m.rsc[id] }}.
Non Informational URI
The non informational uri is the base url of a resource. It always redirects to a representation of the resource. Think of a HTML page, image or JSON download. The chosen representation depends on the .Accept. HTTP request header. The non informational uri of a resource is always like http://example.com/id/1234
Page
Another word for .resource.; used in the admin.
Page connection
Another word for .edge.; used in the admin.
Postback
An AJAX or Websocket request from the browser to the server. It is handled on the server by event/2 Erlang functions. A postback is normally sent to the controller that generated the page, but can be changed by specifying a delegate, which must be the name of an Erlang module.
Predicate
Each edge has a label attached to it to determine what the meaning of the edge is. For instance, when an article is linked to a person, the predicate (label) might read author, to indicate that that person is the author of the article. A predicate is a resource of the category predicate.
Property
A field in a resource. Examples are title and summary. Properties are dynamically defined. Although some property names are reserved, you can set any other property, which will be stored in the resource.
Resource
The main building block of the data model. For simplicity of communication, a resource is often referred to as a page. Every resource usually has its own page on the web site. See Resources.
Scomp
A scomp (from .Screen COMPonent.) is a custom template tag, implemented by an Erlang module named after the scomp name, prefixed with scomp_. Scomps usually generate HTML. Zotonic modules can implement their own scomp in the module.s scomps/ folder.
Session
The session is an Erlang process. It is connected to the session cookie id on the browser. The session contains the id of the current user and more key/value pairs, called session variables. The session is also linked to page processes. For every open page on the browser we have a process on the server. This page process is used for the communication between the server and the user-agent (browser).
Session cookie
A cookie is a small piece of data sent from a website and stored in a user’s web browser while the user is browsing that website. In contrast to perisistent cookies, session cookies are created and kept only during the user’s visit to the website, and deleted from the browser’s cache when the user closes the session.
Tag
The template systems provides tags which function as simple programming constructs. For instance, the if tag can be used for boolean tests and the for tag allows looping. The Zotonic templating system compiles the tags found in a template to Erlang byte code which will be called when the template is rendered. This is very efficient.
Template
A snippet of code which is used to render a piece of content (usually HTML). Templates live under the templates/ folder of a module. The template is meant to express presentation logic.
Translation
There are two kinds of translations. Texts in the templates and Erlang modules; and translations of resources. Templates and Erlang modules are translated using gettext. Resources are translated in the admin, any resource can have an arbitrary number of translations. Zotonic selects the shown language based on the preferred language of the visitor and the available languages of a resource.
Validator
A validator is used to check input fields in a HTML form. A validator has two parts: the client side javascript and a server side check. You add validators to a form with the {% validate %} template tag. A validated query argument can be accessed on the server using z_context:get_q_validated/2.
Wire
Connects actions and events to a HTML element. The wire scomp is the basis for most Ajax interaction on web pages. It allows to connected actions to HTML elements. Examples of actions are showing/hiding elements or postbacks to the server. ..todo:: hmm. It is scomp - it is also a often used function in the Erlang code z_render:wire/2
Zotonic module
A Zotonic module (just .module., for short) is a collection of related functionality like scomps, filters, dispatch rules, controllers, templates, etc. Zotonic modules are OTP applications and are prefixed with zotonic_mod_. See Modules.
Zotonic site
A Zotonic site is a collection of scomps, filters, dispatch rules for one website. It is a special kind of Zotonic module with has its own config file which allows one to set the hostname, admin password, database connection parameters. The config file contains site wide settings. Zotonic uses the settings to start the site on the right port and connect it to the right database. A Zotonic system can run multiple sites.
Zotonic user directory
The directory in which user-installed Zotonic sites and modules are placed. Defaults to the path apps_user relative to the Zotonic installation, but can be adjusted by changing the ZOTONIC_APPS environment variable. See Useful environment variables.

Referred by

Resources

Resources are Zotonic’s main data unit. You may want to familiarise yourself with the Zotonic data model in the User…

Media

Resources can have media resources attached to them. Resources and their media (images, video and audio) are connected…

link

Add an edge between two resources. Used in the admin.

Translation

Many sites need to support content and templates in multiple languages. Luckily, Zotonic is completely multilingual

dialog_duplicate_rsc

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

mod_backup

mod_backup serves two different purposes: it makes a nightly backup of your files and database, and can also backup…

controller_page

Show a rsc as a HTML page.

controller_admin_media_preview

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

draggable

Mark a html element as draggable.

Storing date/time fields

Some interesting tidbits about saving/updating a date/time field of a resource.

controller_id

Handle different content representations of a page.

Page-specific dynamic backgrounds

Use edges ( page connections ) to associate backgrounds with pages.

postback

This action sends a message to the event handler on the server.

mod_oembed

Makes media resources from embeddable URLs through the OEmbed protocol.

mod_comment

Implements a basic commenting system, enabling commenting on resources.

delete_rsc

Delete a resource, without confirmation.

call

Call an Erlang function.

Release 0.10.0

Welcome Zotonic 0.10.0, released on April 18, 2014. These notes list the most important changes for this new feature…

mod_admin_modules

Adds support in the admin for activating and deactivating modules.

dialog_new_rsc

Show the admin dialog for creating a new resource.

url

Generate the URL for a named dispatch rule. In this way it is possible to automatically change the generated URLs when…

controller_admin_category_sorter

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

Access control

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

Controllers

This is the full list of controllers that are available in Zotonic. For more general information about controllers, see…

mod_survey

Adds the concept of survey resources: user-definable forms which can be created in the admin interface and filled out…

The Zotonic data model

Zotonic’s data model is a pragmatic implementation of the Semantic Web: a mixture between a traditional database and a…

dialog_user_add

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

dialog_predicate_new

Show a dialog for creating a new predicate.

typeselect

Show possible selections whilst typing.

make_list

Forces the value to a list.

redirect

This action redirects the browser to another page or back to the previous page.

controller_admin_referrers

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

Controllers

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

controller_website_redirect

This controller does a redirect to the website property of the given 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”…

droppable

Mark an element as valid drag destination.

sortable

Mark an element as sortable.

mailinglist_subscribe

Show the mailinglist subscription form to subscribe to a certain mailinglist id.

delete_media

Delete a media file from a resource, without confirmation.

dialog_set_username_password

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

Command-line

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

mod_translation

This module provides support for dealing with multiple languages.

mod_export

Provides a generic framework to export resources.

Troubleshooting

Installation Zotonic won’t start and shows errors when running zotonic debug Check your site’s database configuration.

controller_admin_edit

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

controller_admin_backup_revision

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

dialog_delete_rsc

Open a dialog to confirm the deletion of a resource.

dialog_edit_basics

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

controller_admin_mailing_status

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

Template Best Practices and Pitfalls

This chapter lists some preferred solutions to common tasks and pitfalls you may encounter while developing with…

mod_import_csv

Module which adds “import CSV” button to the admin status screen.

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…

Sites

Zotonic has the capability of serving more than one site at a time. You can have multiple sites enabled, each with its…

mod_menu

Create nested navigation menus for your site.

sorter

A sorter is a container for sortables.

unlink

Remove an edge between two resources. Used in the admin.

E-mail handling

Any Zotonic system is capable of sending and receiving e-mail messages over SMTP.

mod_email_relay

Enables the Zotonic site to relay emails for the site’s users to their real email addresses.

mod_admin_predicate

Add support for editing predicates in the admin, by presenting a list of all defined predicates on http://yoursite.com…