Search code examples
modxmigx

MODX Revolution MIGX filter TV by date


I'm using MODX Revolution MIGX for a variety of TVs that are displayed in a table via getImageList. I need to filter the results by a date TV to all future dates.

Anyone knows?

Thanks for help.


Solution

  • You need to add a &where clause to your MIGX call and use a snippet to get today's date in a suitable format.

    <?php
    /*
    * Today's date snippet, save as TodaysDate
    */
    return date('Y-m-d H:i:s');
    

    Example where clause:

    [[getImageList?
        &tvname=`my_tv`
        &tpl=`my_tpl`
        &where=`{"my_date:<=":"[[TodaysDate]]"}`
    ]]