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're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

All other Modules /

Discuss all other Modules here.

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

Event Calendar: Can I filter UpcomingEvents on the front page?


Go to End


5 Posts   993 Views

Avatar
otherjohn

Community Member, 125 Posts

10 June 2010 at 5:20am

Hi,
If I had an extra field extended for CalendarEvents, like a category field. Could I filter that with UpcomingEvents()? If so, how should I go about it?
John

Avatar
UncleCheese

Forum Moderator, 4102 Posts

10 June 2010 at 5:39am

I believe the second argument for Calendar::UpcomingEvents() is a filter clause.

Avatar
otherjohn

Community Member, 125 Posts

10 June 2010 at 5:57am

I thought it was the url?

Avatar
UncleCheese

Forum Moderator, 4102 Posts

10 June 2010 at 6:39am

That's for the function that's decorated on the SiteTree. That's just a convenient wrapper for Calendar::UpcomingEvents().

You'll have to write a custom function in your controller.. something like:

if($calendar = DataObject::get_one("Calendar", ... filter clause if necessary))
return $calendar->UpcomingEvents(5, "Category = Foo");
return false;

Avatar
otherjohn

Community Member, 125 Posts

10 June 2010 at 8:10am

Excellent.
Got another question to pick your brain with.

On the list of upcoming events I have this:
Royal Rangers meeting (reoccurring)
Royal Rangers meeting (reoccurring)
Royal Rangers meeting (reoccurring)
Royal Rangers Assembly (onetime)
Some other one time event (onetime)

What would I do to to filter like this.
Royal Rangers meeting (most recent reoccurring of this series)
Royal Rangers Assembly (onetime)
Some other one time event (onetime)

Any idea?