function CortarTexto($texto, $largo=100)
{
$texto = str_replace("
",chr(13),$texto);;
if ($largo=='')
{
return str_replace(chr(13),"
",$texto);;
}
else
{
$texto=strip_tags($texto);
$texto.=" ";
if (strlen($texto) > $largo)
$terminar ='...';
$buscar=' ';
$prev='';
$pos = strpos($texto, $buscar);
$count=0;
while ( (!($pos===false)) && (strlen($prev)<$largo) && (strlen($texto)>0))
{
$count++;
$prev.= substr($texto, 0, $pos+1);
$texto= substr($texto, $pos+1, strlen($texto)-pos+1);
//print($count."
");
$pos = strpos($texto, $buscar);
}
$texto = str_replace(chr(13),"
",$texto);;
return trim($prev.$terminar);
}
}
$sql = 'SELECT * FROM novedades ORDER BY NOV_Id DESC LIMIT 3 ';
$res = mysql_query($sql);
while($row = mysql_fetch_array($res))
{
?>