Location: PHPKode > projects > Batavi > batavi/ext/smarty/plugin/modifier.words_truncate.php
<?php

/**
 * file modifier.words_truncate.php
 *
 *
 * @copyright Copyright (c) 2009, ICEshop BV
 *
 */

 /**
 * Smarty words_truncate modifier plugin
 *
 * @param string $string
 * @param int $count
 * @param string $add
 * @return string
 */

 function smarty_modifier_words_truncate($string, $count = 80, $add = '') {
    $new_str   = '';
    $words     = split(' ',$string);
    foreach ($words as $word) {
      $new_str .= substr($word, 0, $count) . $add . ' ';
    }
    return $new_str;
 }

?>
Return current item: Batavi