Truncates text blocks over the specified character limit and closes all open HTML tags. The method will optionally not truncate an individual word, it will find the first space that is within the limit and truncate at that point. This method is UTF-8 safe.
Signature
public function truncate(string
$text,
[integer
$length = 0,
[boolean
$noSplit = true,
[boolean
$allowHtml = true]]] )
Parameters
$text
The text to truncate.
$length
The maximum length of the text.
$noSplit
Don't split a word if that is where the cutoff occurs (default: true).
$allowHtml
Allow HTML tags in the output, and close any open tags (default: true).