getFilters()
getFilters()
A Tiwg extension that truncates text while preservice HTML tags.
Based on http://alanwhipple.com/2011/05/25/php-truncate-string-preserving-html-tags-words/
truncate(string $text, integer $length = 100, string $ending = '...', boolean $exact = false, boolean $considerHtml = true) : string
Truncates a string up to a number of characters while preserving whole words and HTML tags
| string | $text | String to truncate. |
| integer | $length | Length of returned string, including ellipsis. |
| string | $ending | Ending to be appended to the trimmed string. |
| boolean | $exact | If false, $text will not be cut mid-word |
| boolean | $considerHtml | If true, HTML tags would be handled correctly |
Truncated string.