Developer Guide developer guide

Edit on GitHub  

29 Pages

Introduction developer guide

This is the Zotonic Developer Guide. It takes you through all aspects of Zotonic so you can start building your own sites as quickly as possible. If you are an end user rather than developer, you may…

Getting Started developer guide

You have two options for running Zotonic: to get started quickly, start our Zotonic container. Or you can install Zotonic on your computer. Docker First download and install Docker . Then build and…

Docker developer guide

We offer the Docker image zotonic/zotonic-dev which contains build tools and Erlang. It can be used for development work on Zotonic itself, where you’ll mount your Zotonic directory as a volume in…

The Status site developer guide

The Zotonic “status” site is the first thing you see once you have installed Zotonic, when you do not have any sites configured yet. This is what it looks like: This site is also the fallback site…

Sites developer guide

Zotonic has the capability of serving more than one site at a time. You can have multiple sites enabled, each with its own set of templates, database and dispatch rules. Each site has its own…

Modules developer guide

Modules are the building blocks of Zotonic. They add functionality to your Zotonic website such as: the admin web interface embedding videos in your content search engine optimization (SEO) social…

Controllers developer guide

Controllers are the Erlang modules which decide what happens when a browser requests a page. Zotonic looks at the dispatch rules that match the requested URL, and if a dispatch rule matches, the…

Dispatch rules developer guide

Dispatch rules route incoming requests to controllers . A dispatch rule contains a pattern that is matched against the URL of an incoming request. When a URL is requested by the web browser, the…

Resources developer guide

Resources are Zotonic’s main data unit. You may want to familiarise yourself with the Zotonic data model in the User Guide. Resource properties Resources are very flexible data units: they can have…

Templates developer guide

Templates are text files marked up using the Zotonic template language. Zotonic interprets that mark-up to dynamically generate HTML pages. Zotonic’s template syntax is very similar to the Django…

Media developer guide

Resources can have media resources attached to them. Resources and their media (images, video and audio) are connected through ‘depiction’ edges . Additionally, resources can be embedded in some HTML…

Icons developer guide

Including Zotonic icons CSS Add the CSS file to your template: { % lib "css/z.icons.css" %} This ensures that whenever a Zotonic icon class is used, the image will show up. Writing Zotonic…

Forms and validation developer guide

You should validate all input data entered in forms . In Zotonic you create forms by writing plain HTML. You can attach one or more validators to each input element. Validators define acceptable…

Search developer guide

Using the query search API you can retrieve lists of resources in various ways. In your templates, you do so through the search model : {% for id in m.search [{ query ( options go here ... ) }] %}…

Translation developer guide

Many sites need to support content and templates in multiple languages. Luckily, Zotonic is completely multilingual, out of the box. mod_translation does all the work for you. Zotonic will try to…

Wires developer guide

Wires are the older way to code actions and client/server interaction. It is now advised to use MQTT topics with mod_mqtt instead. Actions The action defines what should happen when the wire is…

Access control developer guide

Access control is about defining who is allowed to access certain resources. It takes two steps: The user is authenticated , that is, the user’s identity is determined based on some form of…

Notifications developer guide

At different moments in the lifecycle of the web request, Zotonic sends notifications. By observing these notifications you can override Zotonic’s behaviour. You can also add your own notifications.

Browser/server interaction developer guide

There are multiple ways to set up interaction between server-side Zotonic code and client-side JavaScript. If you want to initiate the interaction in the client (browser) publish/subscribe. API…

E-mail handling developer guide

Configuration Any Zotonic system is capable of sending and receiving e-mail messages over SMTP. Zotonic implements a mailing system for sending text and HTML messages to one or more recipients. Out…

Command-line shell developer guide

The Zotonic shell gives you access to a running Zotonic instance with its code and data. To connect to the background Zotonic server instance within an EShell (Erlang shell): zotonic shell…

Logging developer guide

Zotonic uses Lager for logging. Lager metadata is automatically set by Zotonic, so to log a message from your code, simply call Lager directly: lager : error ( "Something went very wrong with ~p…

Testing sites developer guide

It is possible to create end-to-end integration tests for Zotonic websites. Tests like these are called sitetests . They run within the Zotonic shell, starting the website under test using a special…

Deployment developer guide

So you have built your Zotonic site, and now you want to show it to the world. This page tells you how to configure your zotonic environment so that it is ready for real-world website visitors. As…

Troubleshooting developer guide

Installation Site doesn’t start Check your database connection configuration in the zotonic_site.config file which is located in the zotonic user directory . This can be found in yoursite/priv…

Contributing to Zotonic developer guide

We encourage contributions to Zotonic from the community! This chapter describes how you can help improve Zotonic. Fork the zotonic repository on Github (at https://github.com/zotonic/zotonic ).

Release Notes release notes

Every time a Zotonic release is made, we create a document which lists the most important changes. This page contains links to the release notes for each release so far, dating back to Zotonic’s…

Upgrade notes developer guide

These notes list the most important changes between Zotonic versions. Please read these notes carefully when upgrading to a new major Zotonic version. Upgrading from 0.x to 1.0 Before upgrading to 1.

Directory structure developer guide

Zotonic is a set of regular OTP applications. These can be found in the repository’s apps/ directory: zotonic / _ build _ checkouts apps / zotonic_core…

⇄ See also

User Guide user guide

Welcome to the Zotonic User Guide. This guide is a non-technical introduction to Zotonic. Table of contents CMS The Zotonic data model User management Issues and features Todo Add more chapters…

∈ Developer guide Category