Source for file modifier.truncate.php
Documentation is available at modifier.truncate.php
* Smarty truncate modifier plugin
* Purpose: Truncate a string to a certain length if necessary,
* optionally splitting in the middle of a word, and
* appending the $etc string.
* @link http://smarty.php.net/manual/en/language.modifier.truncate.php
* truncate (Smarty online manual)
if (strlen($string) > $length) {
if ($break_words) // break the word
$fragment = mb_substr($string, 0, $length + 1);
$etc = "<span style='display:inline;' id='dyn_". $divId. "_display'><a class='truncate' onclick='javascript:toggle_dynamic_var(\"$divId\");' title='". tra('Click to see the full text'). "'>$etc</a></span>";
$etc .= "<span style='display:none;' id='dyn_". $divId. "_edit'>". substr($string, strlen($fragment)). "</span>";
/* vim: set expandtab: */
|