The ceil filter accepts one numeric argument and returns the argument's next highest integer.

{{ 10.3|ceil }}


The count filter accepts one array argument and returns the number of elements in the array.

{{ [1,2,3]|count }}


Splits a string into an array of strings using the specified delimiter. This is typically used when you have a list of items separated by commas or spaces, and want to be able to iterate over them in a loop. An optional second parameter is the maximum number of results to return. If no limit is specified, all of the sub-strings will be returned.

{% set arr as  var|explode(',') %}
{% for item in var|explode(' ', 5) %}


The floor filter accepts one numeric argument and returns the argument's next lowest integer.

{{ 10.3|floor }}


The gravatar filter can be applied to an email address to get the url of a Gravatar image. There are three optional parameters: The size in pixels (defaults to 80), the url of a default image to use if the email is not associated with a Gravatar, and the maximum rating you want to display (defaults to 'g').

<img src="{{|gravatar(100,hifi.urls.images~'gravatar-default.jpg','r') }}" alt="Gravatar">


The imagesize filter is used in templates to resize images and do other processing. The parameters specifying what you want to do to the image should be passed to the filter in the form of a JSON object.

<img src="{{ image_url|imagesize({width:100,height:100,crop:true,bw:true}) }}" alt="Thumbnail" />


All parameters are optional.

  • width: The maximum width of the resulting image. If this is not specified the image will only be resized based on the height.
  • height: The maximum height of the resulting image. If this is not specified the image will only be resized based on the width.
  • crop: If this is set to true, the image will be cropped to match the specified width and height exactly. If you leave out the crop parameter, the image will be resized to fit within the specified width and height, but will retain its original aspect ratio. It only makes sense to crop the image if you also specify both the width and the height.
  • bw: If this is set to true the image will be converted to greyscale.
  • colorize: Set this to an rgb hex code to recolor an image. For example, if you wanted a sepia-toned image: {{ image_url|imagesize({colorize:"#704214"}) }}
  • radius: This rounds the corners of the image to the specified radius (in pixels). If you don't specify a background color (see below) the resulting image will be forced to a 24-bit PNG format. This is notgenerally recommended, unless the source image is also a PNG.
  • background: If the radius is also set, this is used to specify a background color to fill the corners with. For example, if you wanted an image on a bright red background to have corners with a 10-pixel radius: {{ image_url|imagesize({radius:10,background:"#ff0000"}) }}
  • quality: Sets the output quality for JPEG files (ignored for other formats). This should be a number between 0 and 100, the default is 75.


The is_template filter accepts one string argument. The argument is the pathname of a HiFi theme template file relative to the templates directory. This will return true if the template exists, else false.

{% if "page/page.html"|is_template %}
{% else %}
{% endif %}


The json_decode filter takes one valid JSON string argument and decodes it into a PHP array data structure.

{% set data = '{"one": "Foo", "two": "Bar"}'|json_decode %}


The keyed_hash filter will convert its arguments into a keyed hash value using the HMAC method. The first argument is the message to be hashed, and the second argument is the shared secret key used for generating the HMAC variant of the message digest.

{% set hash =  "message"|keyed_hash("secret") %}


The markdown filter runs a markdown conversion on the variable and returns html. It is useful with markdown custom types.

{{ this.custom.content.markdown|markdown }}


The merge filter accepts two object arguments and returns a merge of the two.

{% set data1 = {"one": "Foo"} %}
{% set data2 = {"two": "Bar"} %}
{% set data3 = data1|merge(data2) %}


The merge_array filter accepts two array arguments and merges the two.

{{ array1|merge_array(array2) }}


The merge_object filter accepts two object arguments and merges the two.

{{ object1|merge_object(object2) }}


The nl2br filter accepts one string argument and converts all newline characters into HTML BR tags.

{{ "This is\n a newline"|nl2br }}


The rand filter takes two integer arguments: the first is the minimum bound and the second is the maximum bound. This will return a random integer between the minimum and maximum values, inclusive.

{{ 0|rand(10) }}


regex_replace is similar to the replace filter, except the first paramter should be a regular expression to match, rather than a plain string. You should not surround the regular expression with forward slashes. Optionally, you may also include the modifier flags as a third parameter, and a maximum number of matches to return as the fourth parameter.

{# Standardize the company's name in text #}
{{ entry_text|regex_replace('nmc|new media( campaigns)?','New Media Campaigns','i') }}

For security reasons, you cannot use the "e" (evaluate) modifier.


The round filter accepts two arguments. The first argument is a numeric value to be rounded. The rounding precision is the second optional argument. Returns a numeric value rounded to the specified precision.

{{ 10.345678|round(3) }}


The shuffle filter takes one array argument and returns a new shuffled array.

{% set data = [1,2,3]|shuffle %}


The substr filter outputs a part of the supplied string, beginning at a particular character and optionally stopping after a certain length.

{{ "This is a string"|substr(3,6) }}
{# Returns "s is a" #}

You can also use a negative number for the first argument to start that number of characters from the end of the string.


The to_array filter will convert its input into a PHP array data structure.

{% my_object|to_array %}


The truncate filter trims the given string down to the specified length. It can optionally append another string to end.

{{ my_variable|truncate(30,'... Read more.') }}
{# Returns "This is my strin... Read more." #}


The youtube_video filter takes two arguments. The first argument (required) is the YouTube video ID. The second argument (optional) is a hash containing the keys "height" and "width", each with a numeric value.

{{ "u155ncSlkCk"|youtube_video({ height: 480, width: 600 }) }}