Hello,
thank you for your snippet. I have done few changes (add hidemenu=>false, return integer value)and used this snippet. Please see it below.
$count = 0;
$parent = isset($parent) ? (integer) $parent : 0;
if ($parent > 0)
{
$criteria = array('parent' => $parent, 'deleted' => false, 'hidemenu' => false, 'published' => true);
$count = $modx->getCount('modResource', $criteria);
}
return (integer) $count;
When I use this snippet it work's and the number of children is showed on the page (via chunk).
I need to test it's return value. So when the given ID don't have any children at all a want to ECHO string 'NO, there are no children'. In case that it has at least one children I want to ECHO string 'YES'. This is just for example - in my case, when there is any children I will ECHO some HTML code with the children.
So I tried to do it but it is not working. Please see both ways that I was using. It is just about to test output value of the snippet and if the return values is GT (greater than) 0, then I want to ECHO some code. Can you help me please?
1)
[[ [[!getChildCount? &parent=`[[+id]]`]]:gt=`0`:then=`YES`:else=`NO, there are no children` ]]
2)
[[!getChildCount? &parent=`[[+id]]`:gt=`0`:then=`YES`:else=`NO, there are no children` ]]
Thank you and have a nice day