Hello,
how can i check width phx, if the ditto call has children?
perhaps with something like that, if you want to use phx for that task:
[*phx:if=`[!Ditto? ¶meters.........!]`:isnot=`No documents found`:then=`<p>my Ditto-call has results</p>`*]
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.
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;