modifier.truncate.php
Plugin from smarty project and adapted for jtpl
Tags
Table of Contents
- jtpl_modifier_common_truncate() : string
- modifier plugin : Truncate a string
Functions
jtpl_modifier_common_truncate()
modifier plugin : Truncate a string
jtpl_modifier_common_truncate(string $string[, int $length = 80 ][, string $etc = '...' ][, bool $break_words = false ]) : string
Truncate a string to a certain length if necessary, optionally splitting in the middle of a word, and appending the $etc string.
{$mytext|truncate} {$mytext|truncate:40} {$mytext|truncate:45:'...'} {$mytext|truncate:60:'...':true}
Parameters
- $string : string
-
the string to truncate
- $length : int = 80
-
the number of char to keep
- $etc : string = '...'
-
the string to append to the truncated string
- $break_words : bool = false
-
false if the last word shouldn't be cut