Documentation

All Documentation

show_media

Convert the image markers in HTML from the Rich Text editor into image tags.

signup

Exported APIs:

site

Retrieve information that is stored in the site configuration. If you want to query values from the config table…

Site configuration

This chapter describes the configuration options for your sites. There’s also global configuration.

Sites

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

Site-specific signup actions

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

site_update

Model for checking if a site has version control enabled.

slice

Perform array-slice operations on a list or string.

slide_down

Show an element by animating the height.

slide_fade_in

Show an element by animating the height and opacity.

slide_fade_out

Hide an element by animating the height and opacity.

slide_toggle

Toggle an element by sliding it up and down.

slide_up

Hide an element by animating the height.

slugify

Converts a text into a slug.

sort

The sort filter takes a list of items to sort. Items can be an ordinary list of terms, property lists, or maps. It can…

sortable

Mark an element as sortable.

sorter

A sorter is a container for sortables.

spaceless

Removes whitespace between HTML tags.

spinner

Add an AJAX activity indicator.

split

Splits the filter value into a list of values.

split_in

This filter split a list in shorter lists. It splits an array in N sub-arrays of more or less equal length. This is…

ssl_letsencrypt

Model for Let's Encrypt status information, available to administrators.

Storing date/time fields

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

stringify

Translates atoms, integers and floats to strings. The undefined value is translated to the empty string. Does not…

Strings

append capfirst center filesizeformat format_duration format_integer format_number format_price insert is_valid_email…

striptags

Removes all HTML tags from the value.

sub_day

Subtracts a day from a date. The value must be of the form {{Y,M,D},{H,I,S}} .

sub_hour

Subtracts an hour from a date. The value must be of the form {{Y,M,D},{H,I,S}} .

submit

Submits the enclosing form, a specifically targeted form or the closest form to an element.

sub_month

Subtracts a month from a date. The value must be of the form {{Y,M,D},{H,I,S}} .

sub_week

Subtracts a week from a date. The value must be of the form {{Y,M,D},{H,I,S}} .

sub_year

Subtracts a year from a date. The value must be of the form {{Y,M,D},{H,I,S}} .

sum

Sum a list of numbers.

summary

Extract a summary from a resource.

survey

Dispatch rules Name Path Resource Args survey_results_download [“survey”,”results”,”download”,id]…

Survey

survey_answer_split survey_any_correct_answer survey_any_wrong_answer survey_as_pages survey_is_stop survey_is_submit…

survey

Model for survey reporting and participant state, including results, totals, per-user answers, exports, and result…

survey_answer_split

Filter to split multi-value survey answers on the '#' character.

survey_any_correct_answer

Determine if any answer of a question was correct. Used for showing results of thurstone test questions.

survey_any_wrong_answer

Determine if any answer of a question was wrong. Used for showing results of thurstone test questions.

survey_as_pages

Split the page blocks into pages, prepare them for easy display in the survey question editor.

survey_is_pagebreak_submit

Check if a list of questions contains a pagebreak block with an unconditional submit.

survey_is_save_intermediate

Check if the given survey is configured to save intermediate results. Always returns a boolean value.

survey_is_stop

Check if there is a ‘stop’ question in list of (survey) blocks

survey_is_submit

Check if the questions end with a question type that is a submit button.

Survey notifications

survey_get_handlers survey_is_allowed_results_download survey_is_submit survey_submit survey_result_columns…

survey_page_options

Check the list of blocks and collect all options for that page.

survey_result_column_values

Used by the survey module to add extra column values to the result editor.

survey_saved

Model for saving and retrieving intermediate survey answers for users. There can only be a single intermediate result…

survey_start

Show the first page for a given survey (with the id parameter):

survey_test_max_points

Counts the total of all points that can be received for all test questions. Non test questions are not counted.

tabs

Make a HTML element into a tab set.

tail

Fetch the tail of a list.

template

Model for dynamic template rendering. It renders a template path passed in the request path and returns the rendered…

template

Render a template. When used in a postback action, the result will be sent back with the response data for the postback.

Template Best Practices and Pitfalls

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

Templates

Templates are text files marked up using the Zotonic template language. Zotonic interprets that mark-up to dynamically…

Templates

template

templatetag

Not implemented, but exists in Zotonic for forward compatibility with future ErlyDTL and Django versions.

temporary_rsc

Creates a temporary resource if its input value is not defined.

Testing sites

It is possible to create end-to-end integration tests for Zotonic websites. Tests like these are called sitetests .

tests

Dispatch rules Name Path Resource Args hello_world [“test”,”hello_world”] controller_hello_world []…

The addsite command

Adding a site to Zotonic is done through the zotonic shell command. It syntax is like this:

The Status site

The Zotonic “status” site is the first thing you see once you have installed Zotonic, or if you do not have any sites…

The Zotonic data model

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

timesince

Show a readable version of a date/time difference.

tkvstore

Simple read-only interface to the typed key-value store of mod_tkvstore. To get a value from the store: use m.tkvstore.

to_binary

Convert the input to a binary value.

to_boolean

Convert the input to a boolean value.

toc

Filter to derive a Table Of Contents from a HTML body.

toggle

Toggle the visibility of an element.

toggle_class

Toggle a CSS class from an HTML element.

to_integer

Convert the input to an integer value.

to_json

Display any value as in JSON (JavaScript Object Notation).

tokens

Returns a list of tokens from input string, separated by the characters in the filter argument.

to_name

Map a string to a name . That is a lowercased string with only [a-z0-9_] characters.

trans

See also

trans_ext

See also

trans_filter_filled

Filters all empty translations from a property.

trans_languages

Return a list of all languages present in the given translated text ( #trans{} record).

translate

Translates a (English) value to the current language or the given language.

Translation

is_rtl language language_dir language_sort language_sort_localized media_for_language set_url_language trans_languages…

Translation

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

translation

The m_translation model gives easy access to language and translation related information.

translation

Lookup a specific translation in a translated text. If the text is not translated then the text is returned as-is.

trigger_event

Trigger a named \{% wire %\} with an action. All args will be args to the named wire. The trigger’s name argument is…

trim

Removes whitespace at the start and end of a string.

Troubleshooting

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

truncate

Truncate a text to a maximum length.

truncatechars

Truncate a text to a maximum length in characters.

truncate_html

Truncate a HTML text to a maximum length.

Tuples

element

typeselect

Show possible selections whilst typing.

unescape

Removes HTML escaping from a text.

unlink

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

unmask

Removes a mask that was placed over an element using the mask action.