Ver Mensaje Individual
  #1 (permalink)  
Antiguo 04/01/2009, 09:15
AlvaroX
 
Fecha de Ingreso: septiembre-2008
Mensajes: 242
Antigüedad: 15 años, 8 meses
Puntos: 3
Paginar noticias

Buenas hace un tiempo postie que tengo un sistema de noticias con xml con esta estructura:

noticias.xml:

Código:
<?xml version="1.0" encoding="utf-8"?>
<noticias>

<noticia>
<title>Titulo2</title>
<body>Cuerpo noticia 2</body>
<fecha>fecha 2</fecha>
</noticia>

<noticia>
<title>Titulo1</title>
<body>Cuerpo noticia 1</body>
<fecha>fecha 1</fecha>
</noticia>

</noticia>
Este es un ejemplo el archivo debe tener mas de 50 noticias y tengo este script para visualizarlas todas

Código PHP:

<?

$archivo 
"noticias.xml";
$open fopen($archivo"r");
$leer fread($openfilesize($archivo));

$XML simplexml_load_string($leer);
$i 0;

foreach(
$XML->noticia as $new)
{
echo 
"<fieldset><legend><font color=red><b>$new->title</b></font></legend><textarea readonly=\"readonly\" rows=\"15\" cols=\"50\">$new->body</textarea><br><br/><font color=\"gray\" size=\"2\">$new->fecha</font></fieldset>";
}
?>
Bueno lo que quiero hacer es paginar eso, vale decir mostrar por ejemplo 5 noticias por pagina. pero no se me ocurre el mecanismo