We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 52921
    • 2 Posts
    Hi @all =)
    I would like to filter some content I get with getResource.
    In the used Template is a template variable that contains a time, called "fixedtime".
    Now, I like to show only the content, that has its "fixedtime" in the future. You see my trial below.

    I Would be really thankful for some help!
    Sorry for my bad english.

    Philipp

        $page = $modx->runSnippet('getResources', array(
            'parents'        => $parent,
            'limit'          => $limit,
            'offset'         => $offset,
            'includeTVs'     => '1',
            'tvPrefix'       => '',
            'includeContent' => '1',
            'tpl'            => $tpl,
            'sortbyTV'        => 'fixedtime',
            'sortdirTV'        => 'ASC',
            'tvFilters'     => 'fixedtime>=' . date('Y\-d\-m G:i:s')
      • 3749
      • 24,544 Posts
      I'm assuming that you have )); at the end of that code.

      I think you need &processTVs=`1` to do it that way, since the raw value of the TV is a timestamp.

      This should also work (without &processTVs=`1`), and would be a little faster:

      'tvFilters' => 'fixedtime>=' . strftime(12/12/2017)
        Did I help you? Buy me a beer
        Get my Book: MODX:The Official Guide
        MODX info for everyone: http://bobsguides.com/modx.html
        My MODX Extras
        Bob's Guides is now hosted at A2 MODX Hosting