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
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. |
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.)
Balazs Halasy (06/02/2004 12:08 pm)
Svitlana Shatokhina (22/11/2006 5:35 pm)
Comments
fetching the right language
Wednesday 07 June 2006 9:49:11 am
Xavier Gouley (Smile)
Default language code is english ;
My language code is "fre-FR" (only for my siteaccess front-office) ;
I'm in the pagelayout.tpl, for the french siteaccess ;
I fetches the current node (instead of $node that is not defined in the pagelayout) to $currentNode ;
Now, if I write : $currentNode.object|attribute, I retrieves the fre-FR version,
BUT if I write $currentNode.object.data_map|attribute, I retrieves the english version...
Finally, I can't have the french version of an attribute !
Is it a bug (ez 3.8) ?