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've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

All other Modules /

Discuss all other Modules here.

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

eventCalender module: displaying events on a custom pagetype


Go to End


6 Posts   1675 Views

Avatar
not2dumb

Community Member, 16 Posts

23 July 2009 at 11:09pm

hi folks, especially uncle cheese,
today i've added the eventcalender on my site, works very fine!
now i'm wondering if there is a way to display a given number of most recent events on a non calender pagytype page, eg. the startpage?

i hope there is?!

cheers, p.

Avatar
UncleCheese

Forum Moderator, 4102 Posts

24 July 2009 at 1:14am

Yeah, this question comes up a lot. What I usually do is put this function in my Page_Controller class so I can use it on any pagetype.

function UpcomingEvents()
{
return DataObject::get_one("MyCalendarClass")->UpcomingEvents(5);
}

Avatar
not2dumb

Community Member, 16 Posts

24 July 2009 at 1:33am

hi uc,
thanx 4 the fast reply - i'm gonna check this out 2night! :-)

thanx

Avatar
DrWebGuy

Community Member, 16 Posts

24 July 2009 at 7:37am

How does one implement upcoming events for multiple calendars? I get terrible errors when I try to call return DataObject::get_one("Calendar")->upcomingEvents(5, "CalenderID = 31"); (using 31 as example). When I just leave it alone - all I get is events from the first calendar.

I have multiple calendars for different sports programs. (ie. Men's Basketball, Women's Basketball, Softball, etc.)

I would also (while I'm on the subject) like to modify the ICS feed function to cache the feed from a calDav server into the calendar database as announcements, to reduce load time and server strain when the calendar page is called. Any idea where I should begin?

Avatar
UncleCheese

Forum Moderator, 4102 Posts

25 July 2009 at 8:32am

Are you using any recurring events or announcements? I that case it might be easier just to do DataObject::get("CalendarDateTime", null, "StartDate ASC");

Otherwise, you can get the DO sets for each calendar using UpcomingEvents, run a merge on them, then use CalendarUtil::date_sort() to get them all squared away before returning them to the template.

I'd love to find a way to cache those ICS feeds. It adds a lot of overhead. Let me know if you have any ideas.

Avatar
UncleCheese

Forum Moderator, 4102 Posts

25 July 2009 at 8:39am

Edit:

Are you using any recurring events or announcements? I that case it might be easier just to do DataObject::get("CalendarDateTime", null, "StartDate ASC");

Should say "if that's NOT the case"