Jump to:

10931 Posts in 2614 Topics by 1810 members

All other Modules

SilverStripe Forums » All other Modules » Return Events only (not announcements) from EventCalendar

Discuss all other Modules here.

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

Page: 1
Go to End
Author Topic: 693 Views
  • NickJacobs
    Avatar
    Community Member
    144 Posts

    Return Events only (not announcements) from EventCalendar Link to this post

    Hi, I'm trying to return a list of upcoming main events (excluding announcements) from the EventCalendar. I only want to display events where there is an actual CalendarEvent page....

    Is there a simple way to do this using the Calendar built in functions?

    Cheers
    Nick

  • UncleCheese
    Avatar
    4085 Posts

    Re: Return Events only (not announcements) from EventCalendar Link to this post

    Hi, Nick,

    Check the UpcomingEvents function in Calendar.php.. at least one of the arguments is a filter (there may even be two).. Anyway, you want to apply one like "is_announcement != 1", and that should work for you.

  • NickJacobs
    Avatar
    Community Member
    144 Posts

    Re: Return Events only (not announcements) from EventCalendar Link to this post

    Hi UC,

    yeah there are two arguments in that function, but I've tried a few variations and I either get errors or no result....

    this works (but doesn't give me access to any calendar functions):

    function getHomeFeatureEvents(){
    return DataObject::get("CalendarDateTime","StartDate >= DATE(NOW()) AND is_announcement!=1","StartDate ASC","",5);
    }

    but this doesn't:

    return DataObject::get_one("Calendar")->upcomingEvents(5,"is_announcement != 1");
    {/code]

    693 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.