Thanks for that great tip, Chris. Eventually, I found some PHP code to create a file to display the feed as article links. So I called it article.php. I can't remember where I found it so here is the code in full:
PHP Code:
<?php
$_item = array();
$_depth = array();
$_tags = array("dummy");
function initArray()
{
global $_item;
$_item = array ("TITLE"=>"", "LINK"=>"",
"DESCRIPTION"=>"", "URL"=>"");
}
function startElement($parser, $name){
global $_depth, $_tags, $_item;
if (($name=="ITEM") ||
($name=="CHANNEL")
|| ($name=="IMAGE")) {
initArray();
}
@$_depth[$parser]++;
array_push($_tags, $name);
}
function endElement($parser, $name){
global $_depth, $_tags, $_item;
array_pop($_tags);
$_depth[$parser]--;
switch ($name) {
case "ITEM":
echo "<p><a href=\"{$_item['LINK']}\">" . "{$_item['TITLE']}</a><br />
{$_item['DESCRIPTION']}</p>\n";
initArray();
break;
}
}
function parseData($parser, $text){
global $_depth, $_tags, $_item;
$crap = preg_replace ("/\s/", "", $text);
/* is the data just whitespace?
if so, we don't want it! */
if ($crap) {
$text = preg_replace ("/^\s+/", "", $text);
/* get rid of leading whitespace */
if (@$_item[$_tags[$_depth[$parser]]]) {
$_item[$_tags[$_depth[$parser]]] .=
$text;
} else {
$_item[$_tags[$_depth[$parser]]] =
$text;
}
}
}
function parseRDF($file){
global $_depth, $_tags, $_item;
$xml_parser = xml_parser_create();
initArray();
/* Set up event handlers */
xml_set_element_handler
($xml_parser, "startElement", "endElement");
xml_set_character_data_handler
($xml_parser, "parseData");
/* Open up the file */
$fp = fopen ($file, "r") or die ("Could not
open $file for input");
while ($data = fread ($fp, 4096)) {
if (!xml_parse($xml_parser, $data, feof
($fp))) {
die (sprintf("XML error: %s at line %d",
xml_error_string(xml_get_error_code
($xml_parser)),
xml_get_current_line_number
($xml_parser)));
}
}
fclose($fp);
xml_parser_free($xml_parser);
}
parseRDF
("http://www.yoursite.com/external.php?type=rss");
?>