Caution: This documentation is for eZ Publish legacy, from version 3.x to 5.x.
For 5.x documentation covering Platform see eZ Documentation Center, for difference between legacy and Platform see 5.x Architecture overview.



Fetches the number of children of a node.


fetch( 'content', 'list_count',
       hash( 'parent_node_id',     parent_node_id,
           [ 'class_filter_type',  class_filter_type,  ]
           [ 'class_filter_array', class_filter_array, ]
           [ 'attribute_filter',   attribute_filter,   ]
           [ 'main_node_only',     main_node_only,     ] ) )


parent_node_id integer The ID number of the parent node. Yes.
class_filter_type string The type of class filtering (include/exclude). No.
class_filter_array array The classes that should be filtered. No.
attribute_filter mixed Filter logic for attribute level filtering. No.
main_node_only integer Type of nodes that should be fetched (all or main nodes only). No.


An integer (the number of nodes).


This function operates in almost the same way as the "list" fetch function. The difference is that instead of returning the actual nodes, it returns the count (the number of nodes that were found). The "list_count" function takes the same parameters as the "list" function with some exceptions (sorting, grouping, limit/offset, etc. is not supported). Please refer to the documentation of the "list" function for a detailed description of the parameters.


Example 1

{def $count=fetch( 'content', 'list_count', hash( 'parent_node_id', 42 ) )}
Node number 42 has {$count} number of children.

Outputs the number of nodes that are below node number 42.

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

Balazs Halasy (29/04/2005 8:40 am)


  • is [ 'extended_attribute_filter', extended_attribute_filter, ] missing?

    is [ 'extended_attribute_filter', extended_attribute_filter, ] mising, or it is not possible to use it in count?

    • Re: is [ 'extended_attribute_filter', extended_attribute_filter, ] missing?

      I've tried it, and it seems not to be possible. What you could do is |count(); the number of objects you fetched, and if these are limited by using offset or limit, you might consider re-doing the fetch with extended-attribute-filter and without the offset and limit parameters, and then applying |count()....