"J. Atwood" wrote:
> So In ZUBB (my discussion product) I want to be able to show how many
> replies there have been to any one main topic. All replies are 'children' of
> the main post and when I state it with
> <dtml-tree branches=children>
>     Stuff
> </dtml-tree>
> It works and knows that each message is a child of the message.
> When in go through a searchResult to list the message I want to  show many
> replies there are to that message.
> Q: How do I count the 'children' of any one onject?

if children aren't nested
<dtml-let x="objectIds(['childrenClass'])">
<dtml-var "_.len(x)">

if children are nested you probably need a recursive dtml/python method.

in python 

def count_children(o):
        x = o.objectItems(['childClass'])       
        sum = len(x)
        for child, child_name in x:
                sum = sum + count_children(child)
        return sum


Zope maillist  -  [EMAIL PROTECTED]
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-dev )

Reply via email to