View file sys/fnc/vyvod_text.php

File size: 343B
<?
function vyvod_text( $text, $maxwords = 21, $maxchar = 210 )
{
$sep=' ';
$sep2='...';
$words = split($sep,$text);
$char = iconv_strlen($text,'utf-8');
if (count($words) > $maxwords)
{
$text = join($sep, array_slice($words, 0, $maxwords));
}
if ( $char > $maxchar )
{
$text = iconv_substr( $text, 0, $maxchar, 'utf-8' );
}
return $text;
}
?>