Here are some examples to get you started.
Parsing an RSS feed for display is a pretty common task. RSS is just XML, so it's a natural application for coreylib. Here are some examples to get you started.
The code:
<?php
if ($rss = coreylib('http://www.squidoohq.com/lotd/feed/', '10 minutes')) {
$item = $rss->get('item:first');
if ($item->size()) {
echo sprintf('<a href="%s" target="_blank">%s</a>', $item->get('link'), $item->get('title'));
}
}
?>
The link:
The code:
<ul>
<?php
if ($rss = coreylib('http://www.squidoohq.com/lotd/feed/', '10 minutes')) {
$items = $rss->get('item', 5);
foreach($items as $item) {
echo sprintf('<li><a href="%s" target="_blank">%s</a></li>', $item->get('link'), $item->get('title'));
}
}
?>
</ul>
The list of links:
<ul>
The code:
<?php
if ($rss = coreylib('http://www.squidoohq.com/lotd/feed/', '10 minutes')) {
$item = $rss->get('item:first');
if ($item->size()) {
echo sprintf('<h4>%s</h4>', $item->get('title'));
echo chopHTML($item->get('encoded'), 140, true);
echo sprintf('<a href="%s" target="_blank">more...</a>', $item->get('link'));
}
}
?>
The spotlight: