I'm having a slightly different problem but am hoping you can also offer me some help, @willr. I am creating an RSS Feed for a custom DataObjectSet:
function rss() {
$rss = new RSSFeed($this->NewsroomFeed(), "", "Newsroom");
$rss->outputToBrowser();
}
I am loading up an array in NewsroomFeed() as follows:
......
$result = $query->execute();
foreach($result as $sqlResult) {
$Title = $sqlResult['Title'];
$URL = $sqlResult['URL'];
$results->push(new RSSFeedableData(array(
"Title" => $Title,
"Link" => $URL
)));
}
return $results;
As you can see, I created the class you suggested since I was receiving the same error as the other guy. The $URL variable here coming from the resultset is either going to be a LOCAL site link OR an external URL, which is why I don't want to use the Page object to get the Link. In the feed, I want the link to LITERALLY be this value -- the value of the sqlresult URL field. But in RSSFeedableData::Link(), doing:
return $this->getField('URL');
Of course gives me:
Undefined index: URL
Because I am not IN the resultset at that point. There is something about the way this works that I am fundamentally not understanding. I only have two fields here, this shouldn't be too hard. How can I get $URL to replace the Link value in the feed?
Thanks as always,
Garrett