482 CHAPTER 20 (Web site design) WEB SERVICES Listing 20-2.
482 CHAPTER 20 WEB SERVICES Listing 20-2. Rendering an RSS Feed with Magpie channel[’title’]; echo “Latest News from $feedTitle“; foreach ($rss->items as $item) { $link = $item[’link’]; $title = $item[’title’]; // Not all items necessarily have a description, so test for one. $description = isset($item[’description’]) ? $item[’description’] : “”; echo “
$title
$description
“; } ?> Note that Magpie does all of the hard work of parsing the RSS document, placing the data into easily referenced arrays. Figure 20-2 shows the fruits of this script. Figure 20-2. Rendering an RSS feed within the browser As you can see from Figure 20-2, each feed item is formatted with the title linking to the complete entry. So, for example, following the Ohio LinuxFest 2005 link will take the user to http://ablog.apress.com/?p=639#more-639.
Please visit our professional web hosting services to find out about cheap and reliable webhost service that will surely answer all your demands.