API Reference zotonic_mod_base v#1.0.0-rc.17

Modules

controler_api processes authorized REST API requests: It provides an easy way to create API calls to allow computer programs to perform functions on your Zotonic site.

Serve an uploaded-, resized- or library file.

Redirect to the controller controller_file.

This controller is called for serving http error pages.

Handle different content representations of a page.

Controller for transport of MQTT data between the browser (client) and server.

Show a rsc as a HTML page.

Simple controller for connection tests, used on the /test/connection page.

Redirect to another url.

Serve a static page or pages.

Show a template.

This controller does a redirect to the website property of the given resource.

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

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

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

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

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

Return the first element after another element in a list. For example

Appends the argument to the value.

Convert a value to an Erlang atom.

Return the first element before another element in a list. For example

Translate HTML <br/\> elements into ASCII newlines (\n).

Converts the first character of the value to uppercase.

Centers the value in a field of a certain width using spaces.

This filter splits a list in shorter lists. It splits an array in sub-arrays of at most a given length. This is useful when displaying a list of items in columns or rows.

Formats a date or datetime according to the format specified in the argument.

Show a date range.

Calculate the difference between two dates, returning a single part of that difference.

Provide an alternative value in case a value has a falsy value (0, false, undefined or empty string).

Provide an alternative value in case a value is undefined.

Provide an alternative value in case a value is undefined.

Select an element from a tuple or list of tuples.

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

Tests if the value is a date and equal to the argument. The value and the argument must be a tuple of the format {Y,M,D} or {{Y,M,D},{H,I,S}}.

HTML escape a text. Escapes all reserved HTML characters in the value. Escaped strings are safe to be displayed in a HTML page. When you echo a query string argument or path variable then you must escape the value before displaying it on a HTML page.

Ensures thant an HTML escaped value is properly escaped.

Escape the value according to the RFC2445 rules.

Convert any URLs in a plaintext into HTML links, with adding the rel="nofollow" attribute, and replaces all newlines with <br\> tags.

Escapes the value for insertion in JavaScript output.

Escapes the value for safe insertion into JSON strings.

Escape the value for insertion in xml output.

Filters a list on the value of a property, either on absence or inequality.

Extract a specific property from each item in a list.

This filter formats a numeric value as KB, MB etc. This filter can be used to display a number of bytes in a human readable format of kilo- or megabytes.

Filters a list on the value of a property, either on presence or equality.

Filter a list of items based on a property value and optional predicate.

Returns the first character or element.

Replaces ampersands in the value with “&amp;amp;” entities.

Flatten a list to a comma separated string.

Round down a floating point value.

HTML escapes a text.

Show a duration in hours, minutes and seconds.

Show an integer value.

Show an integer or float.

Show a price with decimals.

Parse a string as a JSON (JavaScript Object Notation) value. The returned value can be processed futher.

Groups items of a list by a property.

Group a list of sorted resource ids on their first letter of the title or another rsc property. After grouping, it splits this list in a number of more-or-less even columns.

Similar to group_firstchar, but always uses the title column from the rsc table.

Selects an argument depending on a condition.

Tests whether a value is undefined, returning the given argument.

Tests if a date is in the future.

Tests if a date is in the past.

Returns the index of the first occurrence of the item in the given list.

Prepends the argument in front of the value.

Filter a list of resource ids on category, or test if a single resource id belongs to a category.

Tests if a value is defined.

Test if an integer value is even

Test if a value is a list

is_not_a mirrors is_a. It is particularly useful when iterating over a category and excluding members of a sub-category (iterating over all images associated with a page except images in the thumbnail category).

Test if a value is a number (integer or floating point)

Test if the given URL is a url for the current site.

Tests if a value is undefined.

Filter a list of resource ids so that only the visible ids remain.

Joins the elements of a list. Joins the elements of the input list together, separated by the argument.

Returns the last character or element.

Returns the length of the value.

Translate ASCII newlines (\n) into HTML <br /\> elements.

Justifies the value in a field of a certain width to the left, with spaces.

Translates the value to lower case.

Forces the value to a list.

Match a value with a regular expression.

Take the maximum of the filter value and its first argument.

Translates a string to a md5 hex value.

Filter a list of media items by their medium_language property, return the best matching with the current or given language. Only visible media items are returned.

Finds a value in a list.

A mail-merge like filter where tag-expressions in a text are replaced with the value of their evaluation.

Take the minimum of the filter value and its first argument.

Force the given value in the given range.

Tests if two dates are not equal.

Fetch the nth tail of a list.

Parses an URL (URI) using uri_string:parse/1.

Pickle an Erlang value so that it can be safely submitted with a form.

Pretty print a zotonic value in a template.

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

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

Shuffle a list of values.

Generate a list of integers, with an optional step.

Render a template.

Regular expression replacement of a pattern with a string.

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

Reverse a list.

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

Round a floating point value to the nearest integer.

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

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

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

Translate a string to a sha1 hex value.

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

Perform array-slice operations on a list or string.

Converts a text into a slug.

The sort filter takes a list of items to sort. Items can be an ordinary list of terms, property lists, or maps. It can also be a list of resource ids to be filtered based on their properties. Sort order and properties to sort on are given as arguments to the filter.

Splits the filter value into a list of values.

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

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

Removes all HTML tags from the value.

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

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

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

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

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

Sum a list of numbers.

Extract a summary from a resource.

Fetch the tail of a list.

Show a readable version of a date/time difference.

Convert the input to a binary value.

Convert the input to a boolean value.

Convert the input to an integer value.

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

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

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

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

Filters all empty translations from a property.

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

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

Removes whitespace at the start and end of a string.

Truncate a text to a maximum length.

Truncate a HTML text to a maximum length.

Truncate a text to a maximum length in characters.

Removes HTML escaping from a text.

Translates the value to upper case.

Generates the relative URL for the given dispatch information.

Generates an absolute URL for the given dispatch information.

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

Make a text safe for URLs.

Find urls in the given input and make them clickable.

Translates a datetime from local time to UTC.

This filter splits a list in shorter lists. It splits an array in N sub-arrays of more or less equal length. This is useful when displaying a list of items in columns.

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

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

Show a boolean value as a text.

A ticketing system for out of band MQTT posts via HTTP.

mod_base is the base module, which acts as a container module holding most of Zotonic basic dispatch rules, Actions and Module tags.

Show a pie chart.

Show a pie chart with 3D effect.

Shows which variables are assigned for use in the current template’s scope

Make charts with Google.

Render a JS-aided inplace textbox.

Custom tag which adds a ‘loader’ image to the page and performs a one-time action when loader comes into view.

Inserts a piece of “lorem ipsum” text into the page.

Show a pager for search results.

Add an AJAX activity indicator.

Make a HTML element into a tab set.

Check if an input value evaluates to true.

Check if two inputs are the same.

Support for custom client-side (JavaScript-based) validators.

Validate input date against a given date format.

Check if the content of the input field is an e-mail address.

Regular expression test.

Check the length of a text input.

A validator to check whether a resource’s name is unique

Numerical input and range check.

A validator to check whether a resource’s page path is unique

Performs a custom server side validation of an input value. This allows you to add your own validation logic to HTML form fields.

Check if an input has been filled in or checked.

common code for is_* filters that work on lists of ids.