1

Is there a way to exclude recurring events from the {exp:calendar:events} tag output? I need to display a maximum of 6 upcoming events but only if they are non-recurring events. Example :

{exp:calendar:events
  dynamic="no"
  event_limit="6"
  date_range_start="today"
}

...

{/exp:calendar:events}

Looking at the DB tables Calendar uses I see there is a column in the 'exp_calendar_events' table called 'recurs' which could act as a flag (n/y). Is there any easy way within Solspace Calendar to tap into this so I could exclude events with 'recurs' set to 'y' (without trying to recreate the call with the Query Module)?

1 Answer 1

1

The keyword here is upcoming events. If you're looking to display entries in a chronological order (such as upcoming events), use {exp:calendar:cal}. It's the only tag that can do that kind of accurate ordering.

More detailed on why {exp:calendar:cal} should be used, and how other main Calendar tags work, please refer to this very useful documentation page: http://www.solspace.com/docs/calendar/getting_started/

To remove recurring events from the listing created by {exp:calendar:cal}, you can use the {if event_recurs}{/if} conditional: http://www.solspace.com/docs/calendar/events//#if_event_recurs

FYI, most of the conditionals listed in {exp:calendar:events} are available for use within the {events}{/events} tag pair inside {exp:calendar:cal}.

3
  • Thanks for the response. I understand that I can use conditionals within the {exp:calendar:cal} tag however in this case I need to output a specific amount of events (using the limit parameter). If I use the {if event_recurs} conditional and say only 3 of the first 6 are not recurring it will only display those 3. So basically I want to filter out recurring events before the tag loop commences (as if the cal tag had a recurs="no" parameter). Hope this makes sense :) Commented Oct 2, 2013 at 13:26
  • 1
    Unfortunately there is no parameter for this. As a workaround, you could use PHP to create a loop where a value (eg. $count) increments (up to 6) each time an event is set to be displayed.
    – Solspace
    Commented Oct 7, 2013 at 20:25
  • Didn't think about using a simple PHP variable counter. Thanks for the response. Commented Oct 8, 2013 at 13:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.