Como exibir na mesma linha Rss de noticias - PHP
Olá, estou tentando colocar esse sistema de noticias na mesma linha e para mudar as noticias a cada 10 segundos, alguém teria uma ideia de como fazer isso.
Desde já muito obrigado.
<?php
$titulo = array();
$data = array();
$link = array();
$quantos = 1;
$exibir = 10;
$limite_title = 100;
$items = simplexml_load_file("http://g1.globo.com/dynamo/rss2.xml")->channel->item;
$doc = new DOMDocument;
foreach($items as $item) {
$titulo[] = utf8_decode(substr($item->title, 0, $limite_title)." - ");
$link[] = $item->link;
$data[] = utf8_decode($item->pubDate);
$quantos++;
//Converte o objeto para string
$desc = (string) $item->description;
}
//For principal:
for ($i = $quantos-($exibir+1); $i < $quantos-1; $i++) {
if($titulo[$i]!="") {
echo '<a style="font-size:30px; href="'.$link[$i].'" target="_blank">'.utf8_encode($titulo[$i]).'
<small style="font-size:12px;color:#999;"><br/></a>'.str_replace(" ", " as ", date('d/m/Y H:m:s', strtotime($data[$i]))).'</small>
<hr style="border:1px solid #CCC;"> '.$borda.'
';
}
}
?>Discussão (0)
Carregando comentários...