fetch( 'content', 'tree', hash( 'parent_node_id', parent_node_id, [ 'sort_by', sort_by, ] [ 'offset', offset, ] [ 'limit', limit, ] [ 'attribute_filter', attribute_filter, ] [ 'extended_attribute_filter', extended_attribute_filter, ] [ 'class_filter_type', class_filter_type, ] [ 'class_filter_array', class_filter_array, ] [ 'only_translated', only_translated, ] [ 'language', language, ] [ 'main_node_only', main_node_only, ] [ 'as_object', as_object, ] [ 'depth', depth, ] [ 'depth_operator', depth_operator ] [ 'limitation', limitation ] [ 'ignore_visibility', ignore_visibility ] ) )
Name | Type | Description | Required |
---|---|---|---|
parent_node_id | integer | The ID number of the parent node. | Yes. |
sort_by | array | The sorting mechanism that should be used. | No. |
offset | integer | The offset to start at. | No. |
limit | integer | The maximum number of nodes that should be fetched. | No. |
attribute_filter | mixed | Filter logic for attribute level filtering. | No. |
class_filter_type | string | The type of class filtering (include/exclude). | No. |
class_filter_array | array | The type of nodes that should be filtered. | No. |
only_translated | boolean | Translation filtering (on/off). | No. |
language | string | The language that should be filtered. | 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. |
extended_attribute_filter | mixed | The extended attribute level filter logic. | No. |
as_object | boolean | If TRUE (or omitted), an array of "ezcontentobjecttreenode" objects will be fetched. Otherwise, an array of arrays will be returned. | No. |
limitation | array | Limitation array (emtpy array = access override). | No. |
ignore_visibility | boolean | Makes it possible to fetch hidden nodes. | No. |
The "tree" function is very similar to the "list" fetch function. The only difference is that the tree function fetches child nodes recursively. The recursion depth can be controlled by the "depth" and "depth_operator" parameters. The rest of the parameters behave exactly in the same way as they do for the "list" function. Please refer to the documentation page of the "list" function for a complete explanation of the parameters.
The depth parameter can be used to specify the level of depth (within the branch) that the function should explore when it is running. If the depth is set to one, this function will simply act as the list function. If the depth is greater than one, the function will fetch nodes further down in the branch. The default value is unlimited.
The depth operator can be set to either "lt", "eq" or "gt" - meaning "less than", "equal to" and "greather than". For example, if it is set to 'eq', only nodes with the depth that was specified using the depth parameter will be fetched.
{def $nodes=fetch( 'content', 'tree', hash( 'parent_node_id', 42 ) )} {foreach $nodes as $node} {$node.name|wash} <br /> {/foreach}
This example demonstrates how to fetch all the nodes that are under node number 42 recursively (all children, grand-children, etc. will be fetched). The names of the nodes are displayed.
Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2013 eZ Systems AS (except where otherwise noted). All rights reserved.