-
- 43 Posts
Hi there!
Let's take this setup for example:
- Parent
-- Child
- Parent
-- Child
- Parent
-- Child
-- Child
-- Child
- Parent
-- Child
Would I use getResources to add the number of children of each parent and output them as a string, or would that require a custom snippet?
So for example the output would look like this:
Total Children: (6)
Any ideas?
Thank you!
The web is our sandbox, so let's develop a castle.
-
- 5,888 Posts
Not sure, if this will work.
Create a snippet 'counter' with:
$newvalue = !empty($value) ? $value+1 : 1;
$modx->setPlaceholder('countervalue',$newvalue);
put in your children-tpl-chunks (getResources or wayfinder)
[[!counter? &value=`[[+countervalue]]`]]
and at the end:
[ed. note: Bruno17 last edited this post 10 years, 10 months ago.]