4 December 2010 at 5:50am
I have been learning to utilize different silverstripe modules for a while now and have used the events module, which works great by the way, but came across an interesting situation that I've been having troubles solving. I have a case where there are multiple calendars through out a schools site (i.e. Student Life, Admissions, Athletics) and would like to query all events. I have used an upcomingEvents function that I found on another post, but have been unable to modify it to query all calendars. It grabs the set number of events from the first calendar it comes across.
Yes, there is a way, actually. If you're on the latest version of event calendar (either update your SVN or download from here http://www.leftandmain.com/silverstripe-modules/2010/08/23/eventcalendar/), you'll see on the Feeds tab for the Calendar, there are now checkboxes to include other calendars in the feed. Select the calendars you want to merge into that one, and then you can use the <% UpcomingEvents %> control.
Remember, the first argument for UpcomingEvents is the number of events to show, but the second one is the URLSegment of the calendar. So there you would want to use the URLSegment of your all-inclusive calendar..
SilverStripe tips, tutorials, screencasts and more: http://www.leftandmain.com