Forum

Thread tagged as: Question, Events

Display coming 7 days of events?

Hi I'm trying to limit the event-listning to todays date and the next 6 days. I'm using this code on the page, but can not get the 'value' working (if I hard-code some dates it's working):

<?php perch_events_custom(array(
        'filter' => 'eventDateTime',
        'match' => 'eqbetween',
        'value' => date('Y-m-d H:i:s', strtotime('+6 day')),
        'sort'=>'eventDateTime',
        'sort-order'=>'desc',
        'template'=>'listing/event-day.html'
 )); ?>

I get no php errors and all the events are listed (including old ones).

Can this be done in this way or do I need to use a filter? I tried by create a filter but did not understand where to register the filter:

PerchSystem::register_template_filter('sevendays', 'PerchTemplateFilter_sevendays');

Best, Magnus

Magnus von Bromsen

Magnus von Bromsen 0 points

  • 4 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

eqbetween expects two dates - you've only given it one.

'value' => date('Y-m-d H:i:s').', '.date('Y-m-d H:i:s', strtotime('+6 day')),

Nice! Many thanks, Drew