Calculate SUM of sub-collections items

Hi,

By following coding suggestions provided by "patrickmj" here

(http://omeka.org/forums/topic/collection-tree-item-count-and-description)

- (thanks Patrick!!) and modifying the code a bit, I managed to get something like that in my Collection_Tree page.

(http://www.weebly.com/uploads/7/6/8/3/7683554/problem_collection_tree.jpg)

Ignore the Greek, the image shows a parent collection followed by 4 sub-collections, followed respectively by a number which is the "total_items" in each collection.

My question: How can I get the parent collection number to show the SUM of total_items in sub-collections, in this case, number seven (7)??

Thanks,

George.

I think that you would have to add them up by looping through the subcollections. You could probably do it using something very similar to the loop you have now, but instead of echoing out the info about subcollections, store it all in a long string of html in a variable. Along the way, you can add up the total then echo it out, then echo out the html for actual display of the subcollections.

Thanks Patrick, I've been waiting for your reply. Would you be kind enough to provide me the code? Unfortunately, I understand the code I read but I fall behind when it comes to write new things myself...

If this is too much for a request, please accept my apologies!