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

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


Reply

5 Posts   748 Views

Avatar
otherjohn

10 June 2010 at 5:20am Community Member, 125 Posts

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

10 June 2010 at 5:39am 4085 Posts

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

Avatar
otherjohn

10 June 2010 at 5:57am Community Member, 125 Posts

I thought it was the url?

Avatar
UncleCheese

10 June 2010 at 6:39am 4085 Posts

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

10 June 2010 at 8:10am Community Member, 125 Posts

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?