Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

FilterDescriptionExample Usage
currency_format

Formats the value into a currency string.

Parameters

  1. currency code
Code Block
{"1.2345" | currency_format "USD"}
md5Hashes the value using MD5.
Code Block
{"some string" | md5}
sha1Hahses the value using SHA1.
Code Block
{"some string" | sha1}
numberformat

Formats the value into a number.

Parameters

  1. number of decimal places
  2. decimal point character
  3. thousands separator character
Code Block
{"12345.6789" | numberformat 2, ".", ","}
wordwrap

 Wraps a string into multiple lines.

Parameters

  1. number of characters per line
  2. break string
Code Block
 {"some string" | wordwrap 5, "\n<br />"}
trimRemoves white space around a string.
Code Block
{" some string " | trim}
upperConverts a string to uppercase.
Code Block
 {"some string" | upper}
lowerConverts a string to lowercase.
Code Block
 {"SOME STRING" | lower}
firstReturns the first element of an array.
Code Block
 {array_of_items | first}
lastReturns the last element of an array.
Code Block
{array_of_items | last} 
join

Combines an array of elements into a delimited string.

Parameters

  1. delimiter (default is ', ')
Code Block
 {array_of_items | join ', '}
lengthReturns the length of an array.
Code Block
 {array_of_items | length}
urlencodeURL encodes an string or array of parameters.
Code Block
 {array_of_items | urlencode}
hyphenizeReplaces white space with hyphens.
Code Block
 {"some string" | hyphenize}
urlize

Converts a URL into an HTML link.

Code Block
 {"http://domain.com/" | urlize}
set_default

Sets a default value when no other value exists.

Parameters

  1. default value
Code Block
 {not_set | set_default "default value"}
humanize 
Code Block
 
capitalize 
Code Block
 
capfirst 
Code Block
 
tighten_space 
Code Block
 
escape 
Code Block
 
escapejson 
Code Block
 
force_escape 
Code Block
 
truncate 
Code Block
 
limitwords 
Code Block
 
filesize 
Code Block
 
image_tag 
Code Block
 
css_tag 
Code Block
 
script_tag 
Code Block
 
links_to 
Code Block
 
links_with 
Code Block
 
strip_tags 
Code Block
 
linebreaks 
Code Block
 
nl2br 
Code Block
 
nl2pbr 
Code Block
 
htmlAttribute 
Code Block
 
extract 
Code Block
 
date 
Code Block
 {"some date string" | date "Y M d"} eg.
{invoice.date_due | date "Y M d"}
relative_time 
Code Block
 
relative_date 
Code Block
 
relative_datetime 
Code Block
 

...