Truncate a string
syntax: {$var|truncate:max-length[:append-hellip][:closest-word]}
public static truncate ( string $var = null, integer $length, boolean $useHellip = true, boolean $closestWord = false ) : string | ||
$var | string | The string passed from the template. |
$length | integer | The maximum length of the truncated string. |
$useHellip | boolean | Should a hellip be appended if the length exceeds the requested length? |
$closestWord | boolean | Truncate on exact length or on closest word? |
return | string |