/ Published in: PHP
La siguiente función muestra los títulos, junto con los enlaces, cargados de un RSS.
Expand |
Embed | Plain Text
function lectorRSS($url,$elementos=6,$inicio=0) { $datos = stream_get_contents($archivo); if ($status['timed_out']) { $noticias = simplexml_load_file($cache_version); } else { $noticias = simplexml_load_string($datos); } $ContadorNoticias=1; echo "<ul>"; foreach ($noticias->channel->item as $noticia) { if($ContadorNoticias<$elementos){ if($ContadorNoticias>$inicio){ echo "<li><a href='".$noticia->link."' target='_blank' class='tooltip' title='".utf8_decode($noticia->title)."'>"; echo "</a></li>"; } $ContadorNoticias = $ContadorNoticias + 1; } } echo "</ul>"; }
You need to login to post a comment.
