All Cook book

Cook book

Admin cookbook

Creating a custom widget on the edit page Customizing the layout of the admin edit page Customizing the style of an admin page Storing date/time fields Admin…

Cook book

Cookbooks

Admin cookbook Creating a custom widget on the edit page Customizing the layout of the admin edit page Customizing the style of an admin page Storing date/time…

Cook book

Create a custom controller

Zotonic comes with a large collection controllers that cover many use cases, so you’ll probably have to resort to custom controllers less often than you may be…

Cook book

Create a custom filter

Create custom template filters to change the way variables are rendered in your templates. By following some simple rules, Zotonic will automatically find the…

Cook book

Create a custom model

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

Cook book

Create a custom tag

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

Cook book

Custom pivots

Search can only sort and filter on resources that actually have a database column. Zotonic’s resources are stored in a serialized form. This allows you to very…

Cook book

Custom search

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

Cook book

Displaying a site map

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

Cook book

Exometer metrics

Zotonic comes with a system for collecting and exporting metrics (such as how much memory is used, how many database requests were made, etc.) called Exometer.

Cook book

Frontend cookbook

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

Cook book

How to add a custom page block

Zotonic comes with a number of standard page blocks: Header, Text and Embed page. Additional page blocks are provided by modules, for example mod_survey uses…

Cook book

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 the HTTP status code, named templates…

Cook book

Icons in templates

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

Cook book

Just enough…

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

Cook book

Logging to Logstash

Logstash is often used for log centralization and analysis. This cookbook describes how to set up Zotonic for logging to Logstash over UDP. As mentioned in the…

Cook book

Other cookbooks

Create a custom action Create a custom filter Create a custom model Create a custom controller Custom pivots Create a custom tag Custom search Pivot Templates…

Cook book

Overriding Zotonic

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

Cook book

Pivot Templates

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

Cook book

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 filters.

Cook book

Security, templates and XSS prevention

Ensuring that you don't fall victim to cross site scripting and other injection attacks takes vigilance, eye for details and especially some good naming habits.

Security, templates and XSS prevention

Cook book

Shell cookbook

Activate/deactivate modules Filter and convert characters Erlang tab completion Debugging db (query) issues Reset a user’s password Restore/upgrade content db…

Cook book

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 it.