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.

All other Modules /

Discuss all other Modules here.

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

events module - querying from multiple calendars


Reply


2 Posts   918 Views

Avatar
muskie9

Community Member, 12 Posts

4 December 2010 at 5:50am

Hello all,

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.

Any tips on this?

Thanks all!

Avatar
UncleCheese

Forum Moderator, 4096 Posts

4 December 2010 at 10:33am

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