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 or inserting $etc into the middle.
* @link http://smarty.php.net/manual/en/language.modifier.truncate.php
* truncate (Smarty online manual)
* @author Monte Ohrt <monte at ohrt dot com>
$break_words =
false, $middle =
false)
if (strlen($string) >
$length) {
if (!$break_words &&
!$middle) {
return substr($string, 0, $length) .
$etc;
return substr($string, 0, $length/
2) .
$etc .
substr($string, -
$length/
2);
/* vim: set expandtab: */
Documentation generated on Sun, 09 Mar 2008 23:52:26 -0300 by phpDocumentor 1.4.0