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

    how can i check width phx, if the ditto call has children?

      • 18481
      • 13 Posts
      Can’t someone help?
        • 4172
        • 5,888 Posts
        perhaps with something like that, if you want to use phx for that task:

        [*phx:if=`[!Ditto? &parameters.........!]`:isnot=`No documents found`:then=`<p>my Ditto-call has results</p>`*]
          -------------------------------

          you can buy me a beer, if you like MIGX

          http://webcmsolutions.de/migx.html

          Thanks!
          • 18481
          • 13 Posts
          Is there a better way?

          I want to check, if an element has a child in the tree. When it is true, the content of the children should be shown with ditto.
            • 4172
            • 5,888 Posts
            you can try a little snippet with something like that:

            <?php
            //[!runDittoIfChilds? &parent=`9999` &tpl=`myTpl`!]
            
            
            $parent=isset($parent)?$parent:$modx->documentObject['id'];
            $tpl=isset($tpl)?$tpl:'@CODE:[+content+]';
            $children=$modx->getChildIds($parent);
            
            if (count($children)>0){
            $output='<div class="Dittooutput">'
            $params['parents']=$parent;
            $params['tpl']=$tpl;
            $output.= $modx->runSnippet('Ditto',$params);
            $output.='</div>'
            }
            return $output;
            
              -------------------------------

              you can buy me a beer, if you like MIGX

              http://webcmsolutions.de/migx.html

              Thanks!