...
Code Block |
---|
{past_due | set_default "not past due" | capitalize} // Produces NOT PAST DUE if past_due is false |
Supported Filters
Filter | Description | Example Usage |
---|
currency_format | Formats the value into a currency string. Parameters - currency code
|
Code Block |
---|
{"1.2345" | currency_format "USD"} |
For Invoice Delivery Email templates, you can use this example which includes the currency code and invoice total tags. Code Block |
---|
{invoice.total | currency_format invoice.currency} |
|
md5 | Hashes the value using MD5. |
Code Block |
---|
{"some string" | md5} |
|
sha1 | Hahses the value using SHA1. |
Code Block |
---|
{"some string" | sha1} |
|
numberformat | Formats the value into a number. Parameters - number of decimal places
- decimal point character
- thousands separator character
|
Code Block |
---|
{"12345.6789" | numberformat 2, ".", ","} |
|
wordwrap | Wraps a string into multiple lines. Parameters - number of characters per line
- break string
|
Code Block |
---|
{"some string" | wordwrap 5, "\n<br />"} |
|
trim | Removes white space around a string. |
Code Block |
---|
{" some string " | trim} |
|
upper | Converts a string to uppercase. |
Code Block |
---|
{"some string" | upper} |
|
lower | Converts a string to lowercase. |
Code Block |
---|
{"SOME STRING" | lower} |
|
first | Returns the first element of an array. |
Code Block |
---|
{array_of_items | first} |
|
last | Returns the last element of an array. |
Code Block |
---|
{array_of_items | last} |
|
join | Combines an array of elements into a delimited string. Parameters - delimiter (default is ', ')
|
Code Block |
---|
{array_of_items | join ', '} |
|
length | Returns the length of an array. |
Code Block |
---|
{array_of_items | length} |
|
urlencode | URL encodes an string or array of parameters. |
Code Block |
---|
{array_of_items | urlencode} |
|
hyphenize | Replaces 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 - default value
|
Code Block |
---|
{not_set | set_default "default value"} |
|
humanize |
| |
capitalize |
| |
capfirst |
| |
tighten_space |
| |
escape |
| |
escapejson |
| |
force_escape |
| |
truncate |
| |
limitwords |
| |
filesize |
| |
image_tag |
| |
css_tag |
| |
script_tag |
| |
links_to |
| |
links_with |
| |
strip_tags |
| |
linebreaks |
| |
nl2br |
| |
nl2pbr |
| |
htmlAttribute |
| |
extract |
| |
date |
|
Code Block |
---|
{"some date string" | date "Y M d"} eg.
{invoice.date_due | date "Y M d"} |
|
relative_time |
| |
relative_date |
| |
relative_datetime |
| |
safe | Prevents the default HTML filtering from being applied. Considers the string safe. |
Code Block |
---|
{"some string" | safe} |
|
Debugging
Adding the following tag to any email template will enable debugging, and display data key value pairs:
...