Código PHP:
<?php
session_start();
include("../reg/config.php");
// armamos la consulta
$_pagi_sql ="SELECT not_ID, titulo, texto, email, DATE_FORMAT(f_alta,'%d/%m/%Y')f_alta, imagen FROM noticias ORDER BY not_ID DESC";
//cantidad de resultados por página (opcional, por defecto 20)
$_pagi_cuantos = 7;
//Incluimos el script de paginación. Éste ya ejecuta la consulta automáticamente
include("paginator.inc.php");
// funcion para recortar un texto
function Recortar($texto,$len){
$chars=strlen($texto);
$texto=strip_tags($texto);
if($chars>$len)
$texto=substr($texto,0,$len-3)."...";
return $texto;
}
?>
<table id="listanoticias">
<tr><td align="center" colspan="2"><b><u>Listado de Noticias</u></b></td></tr>
<tr><td align="center"> </td></tr>
<?php
while($rowNot = mysql_fetch_array($_pagi_result)){
$sql_comentario = "SELECT not_ID FROM comentario WHERE not_ID = '".$rowNot["not_ID"]."'";
$result_comentario = mysql_query($sql_comentario) or die(mysql_error());
$rowC = mysql_num_rows($result_comentario);
$rowNot['imagen']=($rowNot['imagen']!='')?$rowNot['imagen']:'custom.png';
?>
<tr><td rowspan="4"><?php echo "<img src=\"imagenes/".$rowNot['imagen']."\" width=\"100\" height=\"70\" alt=\"Descripcion\" />"; ?></td></tr>
<tr><td style="color:#FFFFFF"><b><?php echo "<u>".stripslashes($rowNot['titulo'])."</u>";?></b></td></tr>
<tr><td><?php echo "Noticia enviada por: ".$rowNot['email']." Fecha: ".$rowNot['f_alta']; ?></td></tr>
<tr><td style="color:#FFFFFF"><?php echo Recortar(nl2br(stripslashes($rowNot['texto'])),145)." <a href=\"mas.php?not_id=".$rowNot['not_ID']."\" target=\"_blank\">Más...</a><br><br>"; ?></td></tr>
<tr><td style="color:#FFFFFF"><?php echo $rowC; ?></td></tr>
<?php } ?>
</table>
<?php
//Incluimos la barra de navegación
echo"<p><div id=\"numeropaginas\">".$_pagi_navegacion."</p></div>";
?>
Me dejas saber