Thanks. P.S. excellent interview with Leo Laporte!
http://www.twit.tv/floss12
Your interview made me think of Cathedrals & Bazaars and the notion of free riders. I've been much of a php free rider myself, but try to find ways to give back, usually through phpmyadmin.net
Thanks to everyone who give their time, and responses to my queries!
John

Rasmus Lerdorf wrote:

John Taylor-Johnston wrote:

Is there something already created to open an rss file, parse it, and include() the useful stuff into an html file?
Not all my students have an rss reader.

http://jtjohnston.ca/jtjohnston.rss


RSS is just XML. Use SimpleXML to map it to a PHP object and just print out whatever you want from it directly.

eg.

<?php
$rss = simplexml_load_file('http://jtjohnston.ca/jtjohnston.rss');
$channel = $rss->channel;
echo <<<EOB
<img src="{$channel->image->url}" style="float: right;"/>
<h1>{$channel->title}</h1>
<h2>{$channel->description}</h2>
EOB;
foreach($channel->item as $item) {
  echo <<<EOB
<h3><a href="{$item->link}">{$item->title}</a> ({$item->pubDate})</h3>
{$item->description}
<br clear="left" />
<hr />
EOB;
}
?>

Very ugly HTML markup there, of course, but add a bit of CSS and make it prettier.

-Rasmus

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to