Skip to the content
Documentation

node

No ratings yet

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.

Contributors

Comments (2 historical)

Written by readers of the earlier documentation sites, kept as they were.

  1. Fetch by 'node_id' does not work

    Santiago ·

    Fetch by 'node_id' does not work. Never works. Can someone explain to me why?

    1. Re: Fetch by 'node_id' does not work

      Santiago ·

      Mea culpa. Was doing something wrong

Comments

Add a comment

Comments are read by a moderator before they appear.