Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

Customising the CMS /

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

How do you extend the RSS Feeds?

Go to End



Community Member, 125 Posts

7 July 2011 at 7:39am

Hi all,
I am trying to extend my rss feeds for the events calendar to include some fields for additional Schemas (like GeoRSS) but can't seem to get it to pass those fields ($longitude and $latitude) to the file.

I have the following code in my calendar.php file, but my question is how do I grab a field like $longitude from the $events DataObjectSet.
I have tried $this->longitude & $events->longitude with no luck. If I do a print_r of the $events I see that it is set. Can someone help me?

public function atom()
		$events = $this->getModel()->UpcomingEvents(null,$this->DefaultEventDisplay);
		foreach($events as $event) {
			$event->Title = strip_tags($event->_Dates()) . " : " . $event->EventTitle();
			$event->Description = $event->EventContent();
		$rss = new EventFeed(
							sprintf(_t("Calendar.UPCOMINGEVENTSFOR","Upcoming Events for %s"),$this->Title), 

		if(is_int($rss->lastModified)) {
			header('Last-Modified: ' . gmdate("D, d M Y H:i:s", $rss->lastModified) . ' GMT');
		if(!empty($rss->etag)) {
		$xml = str_replace(' ', ' ', $rss->renderWith('EventFeed'));
		$xml = preg_replace('/<!--(.|\s)*?-->/', '', $xml);
		$xml = trim($xml);
		header("Content-type: text/xml");
		echo $xml;