Jump to:

10928 Posts in 2612 Topics by 1809 members

All other Modules

SilverStripe Forums » All other Modules » eventCalender module: displaying events on a custom pagetype

Discuss all other Modules here.

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

Page: 1
Go to End
Author Topic: 1138 Views
  • not2dumb
    Avatar
    Community Member
    16 Posts

    eventCalender module: displaying events on a custom pagetype Link to this post

    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.

  • UncleCheese
    Avatar
    4085 Posts

    Re: eventCalender module: displaying events on a custom pagetype Link to this post

    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);
    }

  • not2dumb
    Avatar
    Community Member
    16 Posts

    Re: eventCalender module: displaying events on a custom pagetype Link to this post

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

    thanx

  • DrWebGuy
    Avatar
    Community Member
    16 Posts

    Re: eventCalender module: displaying events on a custom pagetype Link to this post

    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?

  • UncleCheese
    Avatar
    4085 Posts

    Re: eventCalender module: displaying events on a custom pagetype Link to this post

    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.

  • UncleCheese
    Avatar
    4085 Posts

    Re: eventCalender module: displaying events on a custom pagetype Link to this post

    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"

    1138 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.