<?
function cut_text( $text, $maxwords = 27, $maxchar = 350 )
{
$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;

}


?>