Untitled
unknown
php
3 years ago
1.4 kB
2
Indexable
<div id="conteudo_semanal" class="conteudo_semanal"> <?php //COLE O ENDEREÇO DO RSS DE SEU INFORMATIVO ABAIXO, AS ENTRE ASPAS DUPLAS $endereco_do_rss = "https://informativosemanal.com.br/Services/Noticias/rss?auth=MzQ0OQ==&nid=ult"; echo "<!-- $endereco_do_rss -->"; $invalidurl = false; if(@simplexml_load_file($endereco_do_rss)){ $feeds = simplexml_load_file($endereco_do_rss); }else{ $invalidurl = true; echo "<h2>Endereço do semanal errado.</h2>"; } $i=0; if(!empty($feeds)){ $site = $feeds->channel->title; $sitelink = $feeds->channel->link; echo "<img src='{$feeds->channel->image->url}'/>"; echo "<h1>".$site."</h1>"; foreach ($feeds->channel->item as $item) { $title = $item->title; $link = $item->link; $description = $item->description; $postDate = $item->pubDate; $pubDate = date('d/m/Y',strtotime($postDate)); ?> <div class="post"> <div class="post-head"> <h2><a class="feed_title" href="<?php echo $link; ?>"><?php echo $title; ?></a></h2> <span><?php echo $pubDate; ?></span> </div> <div class="post-content"> <?php echo implode(' ', array_slice(explode(' ', $description), 0, 20)) . "..."; ?> <a href="<?php echo $link; ?>">Ler mais</a> </div> </div> <?php $i++; } }else{ if(!$invalidurl){ echo "<h2>Nenhuma notícia encontra</h2>"; } } ?> </div>