node new
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 ] [ 'language_code', language_code] [ 'remote_id', remote_id] ) )
Parameters
Name | Type | Description | Required |
---|---|---|---|
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. |
language_code | string | A new parameter since eZ Publish 4.1. This enables you to fetch a node in a given language | No. |
remote_id | string | A new parameter since eZ Publish 4.1. This enables you to fetch a node by its remote ID number | 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.)
Example 4
fetch('content', 'node', hash('node_id', 66, 'language_code', 'pol-PL'))
This parameter is especially useful when you need to grab content or a URL in a different language than the one users are viewing a siteaccess in.
Example 5
fetch('content', 'node', hash('remote_id', '1b26c0454b09bb49dfb1b9190ffd67cb' ))
Ester Heylen (13/11/2009 11:45 am)
Ester Heylen (18/11/2009 4:57 pm)
Comments
There are no comments.