node

Summary

Fetches a node (identified by either an ID number or a path).

Usage

fetch( 'content', 'node', hash( [ 'node_id',   node_id,  ]
                                [ 'node_path', node_path ] ) )

Parameters

NameTypeDescriptionRequired
node_id integer The ID number of the node that should be fetched. No.
node_path string The path of the node that should be fetched. No.

Returns

An ezcontentobjecttreenode object of FALSE.

Description

This function fetches a single node and returns it as a ezcontentobjecttreenode. The target node must be specified using either the "node_id" or the "node_path" parameter. If no node can be found, or if an error occurs, the function will return FALSE.

Examples

Example 1

{def $my_node=fetch( 'content', 'node', hash( 'node_id', 96 ) )}
{$my_node.name|wash}

Fetches node number 96 and outputs the name of the object that is encapsulated by that node.

Example 2

{def $my_node=fetch( 'content', 'node', hash( 'node_path', 'news/article_test' ) )}
{$my_node.name|wash}

Fetches the node by the specified path and outputs the name of the object that is encapsulated by that node.

Example 3

{def $my_node=fetch( 'content', 'node', hash( 'node_path', 'news/article_test' ) )}
Views: {$my_node.view_count}

Fetches the node by the specified path and outputs the number of times this node has been viewed. (The "updateviewcount.php" cronjob must be run periodically.)

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2013 eZ Systems AS (except where otherwise noted). All rights reserved.