I’m having a bit of trouble with this and I would like some fresh eyes to take a look.
It is hard to explain, so I’ll start with this screenshot...
http://i55.tinypic.com/30k62ix.gif
So from resource 68 I call my ditto with this template:
<div style="clear: both;">
<a href="[~[+id+]~]" title="[+pagetitle+]">[+pagetitle+]</a>
[[getlittercounts?pid=`[+id+]`]]
<br/>
[[EvoGallery? &display=`images` &type=`thumbonly`&docId=`[+id+]`]]
<br/>
<ul>[[EvoGallery? &display=`images` &type=`infoonly`&docId=`[+id+]`]]</ul>
<br/>
<hr/>
</div>
Works as expected, but the fail is in the snippet:
<?php
$children= array ();
$tch= array ();
$ccount=array();
$ws = array();
$o;
$holder = $pid;
$ll = $modx->getPageInfo($holder,1,'id');
$l = $modx->getPageInfo($ll['id'],1,'parent');
$chldv = array_values($modx->getChildIds($holder,1,$children));
foreach ($chldv as $tdoc) {
$children= $modx->getActiveChildren($tdoc, 'menuindex', 'ASC', 'pagetitle, id');
foreach($children as $child) {
$c = 0;
$a=$child['pagetitle'];
$tc=$child['id'];
$tt=$child['parent'];
$t = $modx->getPageInfo($tt[1],1,'pagetitle, id');
$fc=$modx->getActiveChildren($tc, 'menuindex', 'ASC', 'id');
// grab the children
foreach($fc as $zz) {
// $cx=(int)$zz['id'];
// $ql = $modx->getPageInfo($cx,1,'id');
// if there is no children, bail to the next...
// can't figure out a working test for children
foreach($ql as $sw) {
// get a count
$c=$c+1;
}
$o = $o . '<p class="small">' . $c . " " . $a . "</p>";
}
}
return $o;
}
?>
When I get to foreach($fc as $zz) I am totally stuck so ignore most code past that! Back to the screenshot the snippet needs to return the counts for children in docs in 71,72,73. These numbers are just fox example but respective to the screenshot. Of course with another child under 68 makes it worth it - I have another, but it is not pictured.
I had some discussions with a few people earlier and they could not realize this data changes, the keys in the array change...
I know logically what needs to be done, but I’m unable to progress any further. I have tried a few things, so the bottom end of the code probably doesn’t make sense.
Thanks All!
edit: updated snippet code - a bit closer, but need to test for children at a certain point, can’t figure that out.