Ditto’s extender is an opportunity for defining custom placeholders and/ or filters without interfering into snippet’s core code.
Particularly, a custom filter is an interesting thing — it is a callback function that the core code executes on each item in the final dataset.
countDocs extender counts returned documents and sets placeholder with the calculated value.
How to use countDocs
# 1) put countDocs.extender.inc.php file into /assets/snippets/ditto/extenders folder
# 2) call your Ditto as:
[[Ditto? &parents=`3,4,5` &display=`1` ... &extenders=`countDocs` &tpl=`@CODE:[+count+]` ... ]]
In the above example, Ditto counts documents within 3, 4, and 5 containers. Please notice the display parameter set to 1 — placeholders are being attached to each document within the returned dataset while we (most likely) need to obtain this value in one copy.
Comment #1 on: 2010-02-01, 15:17
Comment #2 on: 2011-08-03, 18:49
Comment #3 on: 2012-01-25, 21:09