0

I have a list of upcoming events which I'm pulling by using {exp:calendar:cal}. Is there a way I can limit recurring events so only the first one displays? Using occurrence_count doesn't appear to work.

0

This has been discussed in this thread: Solspace Calendar: Only show next occurrence of recurring event in list of recurring and non-recurring events

Based off this thread, a tutorial on creating a chronological list with unique occurrences can be found here: http://support.solspace.com/solution/categories/115922/folders/190596/articles/4000020599-how-to-display-a-chronological-list-of-events-with-each-unique-event-appearing-only

Summary:

One approach is to use PHP to create an array of unique events, and display your event data only when the event is encountered for the first time in {exp:calendar:cal}. Here's an example (turn on PHP for your template and set it to Output):

{!-- Create the arrays --}
<?php 
    $event_ids = array();
    $event_data = array();
?>

{!-- 
    // Check if the event was already encountered (i.e. is in the array),
    // and store your data in a separate array if this is the first time
    // encountering this event 
--}
{exp:calendar:cal /* your other parameters here */}
<?php 
    if( ! in_array('{event_id}', $event_ids) )
    {
        $event_ids[] = '{event_id}';
        $event_data[] = '* The data you want displayed *';
    }
?>
{/exp:calendar:cal}

{!-- Display event data, still in chronological order --}
<?php 
    foreach($event_data as $data)
    {
        echo $data;
    }
?>

Of course there are likely other strategies, using PHP, Stash, or other means, but the main idea is to create a list/group/array of unique events within your timeframe.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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