Cook book

All Cook book

Activate/deactivate modules

Rescuing a dysfunctional site from the Zotonic shell.

Admin cookbook

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

Admin template specific things

Common markup in admin templates.

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…

Cookbooks

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

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…

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

Debugging db (query) issues

Techniques for finding root cause when queries are involved.

Displaying a site map

For the benefit of search engines and fans of tables of contents you can easily provide a site map.

Dynamic select options using a wired template

Why Suppose you want to wire a change event for a select box to update a another select box, i.e. you want to wire the…

Enabling Growl Notifications

Using growl outside admin requires some magic to make it work.

Erlang tab completion

Get quicker access to Zotonic code on the shell.

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…

Filter and convert characters

Applying Erlang Binary syntax to get fast character manipulation.

Frontend cookbook

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

How to add a custom Content Block

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

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…

Icons in templates

Zotonic provides a couple of ways to show icons in templates:

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.

Just enough…

These Cookbook items each represent a stage in some Zotonic users’ journeys to understand the workings of Erlang and…

Just enough Erlang/OTP and rebar, part 1

Zotonic source code have you scratching your head? Learn Rebar first.

Just enough Erlang/OTP and rebar, part 2

Building a gen_server to front the library and generating documentation.

Just enough Erlang shell

An indispensible tool for both learning and programming Erlang.

Just enough Postgres

Understand the primary data-store of Zotonic.

Just Enough Regular Expressions (in Erlang)

Learn how to manipulate string data with the re module.

Logging to Logstash

Logstash is often used for log centralization and analysis. This cookbook describes how to set up Zotonic for logging…

Managing redirection after login and signup

Configure mod_signup to redirect to something other than a member’s home page.

Other cookbooks

Create a custom action Create a custom filter Create a custom model Create a custom controller Custom pivots Create a…

Overriding Zotonic

This chapter describes how to override the templates, styling and logic provided by Zotonic.

Page-specific dynamic backgrounds

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

Pivot Templates

Search uses database indices on special pivot columns and full text fields.

Reset a user’s password

Emergency password reset when you can’t get into the admin interface.

Restore/upgrade content db from backup

Contributed by: Scott Finnie

Retrieving the category of a page

Getting the category from a URL is somewhat involved, but not impossible. This is an example of what you can do with…

Security, templates and XSS prevention

Ensuring that you don't fall victim to cross site scripting and other injection attacks takes vigilance, eye for…

Share variable binding across blocks

How to avoid having to call the same query inside several blocks of the same page

Shell cookbook

Activate/deactivate modules Filter and convert characters Erlang tab completion Debugging db (query) issues Reset a…

Site-specific signup actions

Performing additional, project-specific actions when a user signs up

Storing date/time fields

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

Updating form field from a dialog

Ever wanted to update a form field from a dialog, possibly giving the user some list to choose from? Here’s how to do…