Skip to content

Instantly share code, notes, and snippets.



Last active Jan 28, 2016
What would you like to do?
Kumbia Partial: show feed

Uso en el view o template

<?php View::partial('feed', '+3 hours', array('name'=>'Blog KumbiaPHP', 'url'=>''),'feeds')?>

Partial: feed

Cache : +3 hours (o +1 day, +1 week, ... )

array con nombre y url del feed

Grupo de cache: feeds (por si quieren borrar la cache o usar otros nombres si se usa más de una vez)

* Visualizar feed RSS por Joanhey
* @param string $name Nombre
* @param string $url URL completa del feed
* @return html
if ($feed = simplexml_load_file($url)): ?>
<div class="feed">
<h3><a href="<?= h($feed->channel->link)?>" title="<?= h($feed->channel->description)?>"><?= $name?></a></h3>
<?php foreach ($feed->channel->item as $item) : ?>
<li><a href="<?= h($item->link)?>" title="<?= h(substr(strip_tags($item->description),0,200))?>..."><?= h($item->title)?></a></li>
<?php endforeach?>
<?php endif?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment