It’s going to be a lot of code but here it goes
[php]
<?php
//get the simplepie library
require_once('inc/simplepie.inc');
//grab the feed
$feed = new SimplePie();
$feed->set_feed_url('http://api.flickr.com/services/feeds/photos_public.gne?tags=johanesburg&lang=en-us&format=rss_200');
//enable caching
$feed->enable_cache(true);
//provide the caching folder
$feed->set_cache_location('cache');
//set the amount of seconds you want to cache the feed
$feed->set_cache_duration(3600);
//init the process
$feed->init();
//let simplepie handle the content type (atom, RSS...)
$feed->handle_content_type();
?>
<?php if ($feed->error): ?>
<p><?php echo $feed->error; ?></p>
<?php endif; ?>
<?php foreach ($feed->get_items(0, 10) as $item): ?>
<li>
<?php
if ($enclosure = $item->get_enclosure()) {
$img = image_from_description($item->get_description());
$full_url = select_image($img, 4);
$thumb_url = select_image($img, 3);
echo '<a href="' . $full_url . '" class="lightbox" title="' . $enclosure->get_title() . '"><img class="photo-main' . $i . '" src="' . $thumb_url . '" /></a>'."\n";
}
?>
<h5 style="background:url(<?php $feed = $item->get_feed(); echo $feed->get_favicon(); ?>) no-repeat; text-indent: 25px; margin: 10px 0 10px;"><?php echo$item->get_title(); ?></h5>
</li>
<?php endforeach; ?>
function image_from_description($data) {
preg_match_all(’/<img src="([^"])"([^>])>/i’, $data, $matches);
return $matches[1][0];
}
function select_image($img, $size) {
$img = explode(’/’, $img);
$filename = array_pop($img);
$s = array(
'_s.', // square
'_t.', // thumb
'_m.', // small
'.', // medium
'_b.' // large
);
$img[] = preg_replace('/(_(s|t|m|b))?\./i', $s[$size], $filename);
return implode('/', $img);
}
[/php]
Now I need to extract the third
tag from the xml description
I’m lost
Thanks for the help!