PDA

View Full Version : Help with RSS feed not displaying "author"



GreatDebateUSA
14 Dec 2009, 02:06 PM
Hello all. I'm working on a php script that is displaying a news feed onto my website. I'm using php and it is working just fine. The problem I'm having is that I can't get the author field to display properly. I plugged in the "author" fields (just copied the format from pubDate, description, and link) but instead of seeing the authors name I just see a link back to the original article. I know the authors name is in the feed because if I capture it using a 3rd party's program (like rssfeedreader) I see the author listed. Also, if I look at the feed directly in IE I can see the authors name. According to the site at Harvard Law; http://cyber.law.harvard.edu/rss/rss.html#sampleFiles (why it's there I don't know) "author" should show the authors name and email address in the feed. I don't really want the email address to show and it doesn't show in the rssfeedreader but I would like to get the authors name to show. Should I use a different word besides "author"? When I look at the feeds in IE and then look at the source I do see a field for "author" but I also see one for "atom:name". Both have the authors name after. The code I'm using has two files plus the code that's in my php page, RSSItem.php, RSSIterator.php and the code in my page is as follows.

<?php

$olderror_reporting =error_reporting(0);
require_once("RSSIterator.php");
require_once("RSSItem.php");

try
{
$rss = new RSSIterator("http://feeds.feedburner.com/Realclearpolitics-Articles", 4);
foreach($rss as $item) {
print("<h3><a href=\"{$item->link}\"target=\'_blank\'>{$item->title}</a></h3>");
print("{$item->pubDate}");
print("<br>{$item->description}<br>");
print("{$item->author}<br><br><br>");
}
}
catch(Exception $e)
{
// here's where do whatever you want to happen if it can't do that, e.g.:
error_log((string) $e);
echo "<p>RSS feed not available</p>\n";
}

?>

Again instead of the authors name, which is all I want I'm getting a link back to the original news article. Any ideas would be greatly appreciated. I'm been searching the net for several days trying to figure this one out. Thanks in advance.

Jeff