Yes respect to Mo.
I am able to get the description to show on the same page as the title, etc, which is great, by adding the get_description to the "foreach($items as $item)" statement to my RSSPage.php. For RSS feeds with longer descriptions (e.g., PUBMED), I would like to be able to link to a separate page on my website to display the full content. But, that seems like a fairly complicated endeavor, beyond my current ability. Also, I kept the Title and Content "casted", but not the date as I couldn't figure out how to change the date format when it was "casted".
public function getItemsFromRSS($feedNum = 0) {
include_once(Director::getAbsFile(SAPPHIRE_DIR . '/thirdparty/simplepie/SimplePie.php'));
$feedItem = array();
array_push($feedItem,$this->Feed1URL);
array_push($feedItem,$this->Feed2URL);
array_push($feedItem,$this->Feed3URL);
$output = new DataObjectSet();
$feed = new SimplePie($feedItem[$feedNum], TEMP_FOLDER);
//init the process
$feed->init();
if($items = $feed->get_items(0, $this->NumberToShow)) {
foreach($items as $item) {
// Cast the Title
$title = new Text('Title');
$title->setValue($item->get_title());
// Cast the Content
$content = new Text('Content');
$content->setValue($item->get_description());
$output->push(new ArrayData(array(
'Title' => $title,
'Content' => $content,
'Date' => $item->get_date ('j F Y, g:i a'),
'Link' => $item->get_link()
)));
}
return $output;
}
}
I also added a "NumberTOShow" variable to the CMS:
...
function getCMSFields() {
$fields = parent::getCMSFields();
$fields->addFieldToTab("Root.Content.RSS", new NumericField("NumberToShow", "Number of Items to show"));
...
Sam