We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 22427
    • 793 Posts
    Thanks again. Glad I have back getPage, but my original question remains open:

    There's a &where property too in my call, working well. In case there are no items matching the criteria,
    the output of [[+itemsTotal]] is empty, not 0.
    Type casting did not help, and Output filters are not working.
    What else could I try?
      • 4172
      • 5,888 Posts
      this is strange, because I get 0, if there are no results.
      Can you test, what you get with that, what I posted earlier?

      [[!getPage?
      &element=`migxLoopCollection`
      &classname=`modResource`
      &limit=`20`
      &totalVar=`itemsTotal`
      &tpl=`@CODE:[[+pagetitle]]<br>`
      &where=`{"parent":"99999"}`
      ]]
       
      [[+itemsTotal]]


        -------------------------------

        you can buy me a beer, if you like MIGX

        http://webcmsolutions.de/migx.html

        Thanks!
        • 22427
        • 793 Posts
        Tried it: The output is empty, not 0.
          • 4172
          • 5,888 Posts
          there must be something else wrong, because

          xPDO::getCount(), which is used internally, does allways return an integer, not an empty string.

          you can try to change the &totalVar to something different

          you can try, if you get something with:

          [[+itemsTotal:is=`0`:then=`null`:else=`[[+itemsTotal]]`]]


          (perhaps the value is 0, but gets removed somehow)

            -------------------------------

            you can buy me a beer, if you like MIGX

            http://webcmsolutions.de/migx.html

            Thanks!
            • 22427
            • 793 Posts
            I tried various snippets similar to yours in Reply #2, to no avail.
            For $modx->getPlaceholder($placeholder) I always get an empty string.
            It seems that the &totalVar property is not handled like other properties.
              • 22427
              • 793 Posts
              Tried this:
              [[+itemsTotal:is=`0`:then=`null`:else=`[[+itemsTotal]]`]]
              The output is, in any case, the same as for
              [[+itemsTotal]]
                • 54245
                • 1 Posts
                i'm having this same problem every time there are no elements for the totalVar to count it doesn't output anything and none of the solutions that were put forth have worked