Filters

Filters transform template variables before they are rendered.

Binaries
first last length to_binary
Booleans
yesno
Dates
add_hour add_day add_month add_week add_year date date_range datediff eq_day in_future in_past ne_day sub_hour sub_day sub_month sub_week sub_year timesince…
Encryption
md5 sha1
Character escaping
brlinebreaks escape escape_check escape_ical escape_link escapejs escapejson escapexml fix_ampersands force_escape linebreaksbr slugify unescape urlencode…
Forms
pickle
HTML
show_media striptags truncate_html sanitize_html sanitize_url urlize embedded_media without_embedded_media
Lists
after before chunk exclude filter first flatten_value group_by index_of is_list join last length make_list member nthtail random randomize range reversed slice…
Mailing list
inject_recipientdetails mailinglist_recipient_key_decode
Menu
menu_flat menu_ids menu_is_visible menu_expand menu_rsc menu_subtree menu_trail
Miscellaneous
gravatar_code ip2country ip2geo is_letsencrypt_valid_hostname format_dispatch_controller_option format_dispatch_path_element
Numbers
filesizeformat format_duration format_integer format_number format_price is_even is_number max min minmax rand round round_significant to_integer…
Regular Expressions
match replace
Resource lists
group_firstchar group_title_firstchar is_a is_not_a is_visible media_for_language
Resources
admin_merge_diff content_type_label content_type_urls summary temporary_rsc
Strings
append capfirst center filesizeformat format_duration format_integer format_number format_price insert is_valid_email length ljust log_format_stack lower…
Survey
survey_answer_split survey_any_correct_answer survey_any_wrong_answer survey_as_pages survey_is_stop survey_is_submit survey_prepare_matching…
Translation
is_rtl language language_dir language_sort media_for_language set_url_language trans_languages trans_filter_filled translation
Tuples
element
URLs and links
is_site_url url url_abs sanitize_url is_letsencrypt_valid_hostname urlize escape_link urlencode urldecode parse_url
Variables
as_atom default if if_undefined is_defined is_undefined make_value pprint to_binary to_integer to_json

Controllers Reference Tags

All Filters

pprint

Pretty print a zotonic value in a template.

rand

Generates a random number. The number is from, and including, 1 up to, and including, the input value.

random

Returns a random value from a list of values. When the input is an empty list or not a list then the result is…

randomize

Shuffle a list of values.

range

Generate a list of integers, with an optional step.

replace

Regular expression replacement of a pattern with a string.

replace_args

Replace $N placeholders in string from a list of replacement values.

reversed

Reverse a list.

rjust

Justifies the value in a field of a certain width to the right, using spaces.

round

Round a floating point value to the nearest integer.

round_significant

Round a number value to a number of significant digits. The significance defaults to two digits.

sanitize_html

Sanitize a HTML code. Removes elements and attributes that might be dangerous, like <script> elements.

sanitize_url

Sanitize an URL. Removes URLs that might be dangerous, like javascript: URLs.

set_url_language

Change the language of an URL to another language. Useful to generate alternative URLs for a page.

sha1

Translate a string to a sha1 hex value.

show_media

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

slice

Perform array-slice operations on a list or string.

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…

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…

stringify

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

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

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

summary

Extract a summary from a resource.

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_stop

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

survey_result_column_values

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

survey_test_max_points

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

tail

Fetch the tail of a list.

temporary_rsc

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

timesince

Show a readable version of a date/time difference.

to_binary

Convert the input to a binary value.

toc

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

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

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

trim

Removes whitespace at the start and end of a string.

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.

unescape

Removes HTML escaping from a text.

upper

Translates the value to upper case.

url

Generates the relative URL for the given dispatch information.

url_abs

Generates an absolute URL for the given dispatch information.

urldecode

Decode a text where characters are encoded as URL-safe characters.

urlencode

Make a text safe for URLs.

urlize

Find urls in the given input and make them clickable.

utc

Translates a datetime from local time to UTC.

vsplit_in

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

without

Remove the items given in the argument from the filter value.

without_embedded_media

Filter out media ids that are embedded in the body , body_extra and text blocks of your page.

yesno

Show a boolean value as a text.