truncate

Top  Previous  Next

This truncates a variable to a character length, default is 80. As an optional second parameter, you can specify a string of text to display at the end if the variable was truncated. The characters in the string are included with the original truncation length. By default, truncate will attempt to cut off at a word boundary. If you want to cut off at the exact character length, pass the optional third parameter of true.

Example:

Input:

       Two Sisters Reunite after Eighteen Years at Checkout Counter

Template:

       {#article|truncate:30:"...":true#}

Output:

Two Sisters Reunite after E...