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 WOul 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();'
        ));
      • 36818
      • 119 Posts
      Hi veuerfogel,

      probabely you have first to convert the two dates in the same format.
      1. what format does
      fixedtime
      have? (e.g. "Y-m-d HH:MM")
      2.
      date()
      should in the same format (e.g.
      date('Y-m-d')


      so:

      $date = date('Y-m-d');
      ...
      'tvFilters'     => 'fixedtime<=$date'