Forum

Thread tagged as: Discussion, Events

Function 'perch_events_listing()' won't run conditional

Continuing from my previous thread, I'm trying to get the output of an events list to close a container <div> and then open a new <div> for every three event items.

The goal is very much like the example shown in the tutorial video for the every conditional. My use of <perch:every count="3"> seems to be correct because when I pass the same template to perch_events_custom it works as I expect.

When I use perch_events_listing, it is clearly using the same template that I've copied into templates/events/listing out of the original addon directory and then modified with the new conditional. The debug output confirms that it's the same template. However, when I use perch_events_listing the markup that I want to output only for every third item is output for every single item.

I could just use perch_events_custom---except that I can't figure out how to filter it relative to the current date. I see how to filter by passing filter, match, and value, but how can I make it always output the latest events? Is there a variable I can pass in value that always represents today's date?

Otherwise, is there a way to make <perch:count> work with perch_events_listing?

Paul Lee

Paul Lee 0 points

  • 5 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

perch_events_custom([
    'filter' => 'eventDateTime',
    'match' => 'gte', 
    'value' => date('Y-m-d H:i:s'),
]);

Perfect. Thank you.