ibexa

Caution: This documentation is for eZ Publish legacy, from version 3.x to 5.x.

tree_count

Summary

Fetches the number of children of a node recursively.

Usage

fetch( 'content', 'tree_count',
       hash( 'parent_node_id',            parent_node_id,
           [ 'class_filter_type',         class_filter_type,         ]
           [ 'class_filter_array',        class_filter_array,        ]
           [ 'attribute_filter',          attribute_filter,          ]
           [ 'extended_attribute_filter', extended_attribute_filter, ]
           [ 'main_node_only',            boolean,                   ]
           [ 'depth',                     depth,                     ]
           [ 'depth_operator',            depth_operator             ] ) )

Parameters

NameTypeDescriptionRequired
parent_node_id integer The ID number of the parent node. Yes.
class_filter_type string Filter type for class filtering (include/exclude). No.
class_filter_array array The type of nodes that should be filtered. No.
attribute_filter mixed Filter logic for attribute level filtering. No.
extended_attribute_filter mixed The extended attribute level filter logic. No.
main_node_only boolean Type of nodes that should be fetched (all or main nodes only). No.
depth integer The maximum level of depth that should be explored. No.
depth_operator string The logic to use when checking the depth. No.

Returns

An integer (number of nodes).

Description

This function works in the very same way as the "tree" function. The difference is that it returns only the number of nodes (instead of the actual nodes). Please refer to the documentation of the "list", "list_count" and the "tree" fetch functions.

Examples

Example 1

{def $count=fetch( 'content', 'tree_count',
                   hash( 'parent_node_id',     42,
                         'class_filter_type',  'exclude',
                         'class_filter_array', array( 'folder', 'comment' ) ) )}
 
Number of nodes: {$count}

This example counts the number of nodes that are children of node number 42, recursively. Nodes that reference "folder" or "comment" objects will be excluded from the count.

Balazs Halasy (06/02/2004 12:15 pm)

Svitlana Shatokhina (29/03/2007 2:04 pm)

Balazs Halasy, Svitlana Shatokhina


Comments

There are no comments.