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:

All other Modules /

Discuss all other Modules here.

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

Event Calendar Module - Upcoming Events from Multiple Calendars

Go to End

2 Posts   955 Views


Community Member, 8 Posts

17 July 2012 at 4:34pm


I have three event calendars on my site and I would like to display the upcoming events on the home page. The problem is, I can only get it to display events from my first calendar (but the calendar I want to use on the home page is not the first one).

I have tried in the template using

<% control UpcomingEvents(5, 'calendar') %>

and also
 <% control UpcomingEvents(5, calendar) %>

where my URLSegment is calendar, but it is still getting the events from the first calendar in the database.

Can anyone please help me with how I get it to show a different calendar?

Thank you


Community Member, 8 Posts

18 July 2012 at 2:30pm

in case anyone else is trying to work this out I wound up changing the upcomingEvents function called from my HomePage.php (mysite/code/HomePage.php) from:

function UpcomingEvents() {
		return DataObject::get_one("Calendar")->upcomingEvents(5);

function UpcomingEvents() {
		return DataObject::get_one("Calendar", "URLSegment = 'calendar'")->upcomingEvents(5);

If anyone has a better solution i would love to hear it as obviously if my client changes the URL this will no longer work.