Hi everyone, I have a getResources call that comps published date to current date to show a number of new items (less than 14 days old). Custom snippet works fine. Here is my code:
[[!getResources? &where=`{"publishedon:>=":[[!getCurrentTimeMinus]]}` &parents=`225` &toPlaceholder=`number` &limit=`0` ]]
<div id="new-videos"><span>[[+total]]</span> New Videos</div>
I'm not using a tpl, as I just want the total output. The above works.
HOWEVER, when I try to change it to this:
[[+total:is=`0`:then=``:else=`<div id="new-videos"><span>[[+total]]</span> New Videos</div>` ]]
I get no output returned. Can anyone tell me what I am doing wrong? I tried calling [[!+total]] but no luck there.
Thanks in advance for any help!
Not sure if this will work:
snippet ifResults:
<?php
$results = $modx->runSnippet('getResources',$scriptProperties);
if (!empty($results)){
return $then;
}
[[!ifResults?
&where=`{"publishedon:>=":[[!getCurrentTimeMinus]]}`
&parents=`225`
&limit=`1`
&then=`<div id="new-videos"><span>[[+total]]</span> New Videos</div>` ]]