We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 5913
    • 42 Posts
    Hello,

    I have searched and searched but I cant seem to figure this one out. I need to get the total number of documents that are being returned by ditto inside the template but [+total+] doesnt seem to do the trick if you are not using pagenation (which I am not)

    Anythoughts smiley

    THanks in advance
    Crash1hd
      • 10449
      • 956 Posts
        • 5913
        • 42 Posts
        I guess I should mention I tried that however this is the snippet call I do for ditto (that I would have to duplicate for my total)

        //[!Ditto?parents=`2,3`&depth=`0`&display=`all`&tpl=`coverflowTpl`&filter=`hidemenu,0|tvscreenShotRaw,[*screenShotRaw*],2`!]
        $documents = $this->modx->runSnippet("Ditto", array(
        "parents" => ’2,3’,
        "display" => "all",
        "depth" => "0",
        "filter" => "hidemenu,0|tvscreenShotRaw,[*screenShotRaw*],2",
        "tpl" => "@CODE [+id+]," ));

        $documents = explode( ’,’, $documents);

        $totalDocs = (count($documents) - 1);

        but $totalDocs only returns 40 when it should return 29 which the commented out ditto call returns when you count them (basically cause it doesnt seem to be running the filter part)
          • 5913
          • 42 Posts
          I also tried this method

          $dittoID=’dittoTest’;

          $resource = $this->modx->getPlaceholder($dittoID . "_ditto_resource");
          $c = count($resource);

          an adding the id to the ditto call (which works if I was calling the snippet that needed the returned number after the original ditto snippet is called but I need the number inside the tpl (chunk) of the original ditto call which returns 0.

          My Guess is that I have to run a custom db call to get the data unless there is a way of getting the runSnippet to do the filter?
            • 5913
            • 42 Posts
            Ok got it nevermind smiley

            had to pass the tv through to the snippet as a variable

            ie

            "filter" => "hidemenu,0|tvscreenShotRaw,$tv,2",

            and yet it works even though $tv = ’’ but if I call

            "filter" => "hidemenu,0|tvscreenShotRaw,’’,2",
            doesnt work? I dont get it (if anyone knows why please let me know)