a wee weblog, since 2006

taxonomy:
get_node

20Jul
2013

This tag returns information about a single node, and optionally it's parent.


Tag Parameters

tree_id=

tree_id="1"

The id of the tree which contains the node want to fetch. This is a required parameter.


entry_id=

entry_id="{entry_id}"

The entry_id of the entry associated with the node.


node_id=

node_id="3"

The node_id of the node.


key= val=

key="lft" val="4"

The key which you'd like to use to select the node, and the value to check against it.

Alternative to entry_id and node_id parameters, you can also select a node using a number of key/value parameter pairs.

Example 'key' / 'val' combinations are:

key="node_id" val="3"
key="lft" val="2"
key="rgt" val="7"
key="label" val="About Us"
key="entry_id" val="3"
key="custom_url" val="/foo
key="title" val="My Entry Title"
key="url_title" val="entry-title"
key="entry_date" val="1374275460"
key="url" val="http://example.com/foo"
key="my_taxonomy_custom_field" val="Allo Allo"

Code Example


var_prefix=

var_prefix="tx_"

Prefix variables to avoid conflicts with other tag variables


add_globals=

add_globals="yes"

Merge the returned variables into ExpressionEngine's global variables array. This allows you to call a variable from anywhere within embedded templates after this tag is called. Note if you are using this feature it's best to use the var_prefix param to avoid variable clashes elsewhere.


Tag Variables

These varables are available between the tag pair

VariableExample Output / Notes
{this_tree_id}2 The Tree ID for this node
{this_node_id}22 The node_id of this node
{this_node_lft}2 The 'lft' value of this node
{this_node_rgt}5 The 'rgt' value of this node
{this_node_label}About Us The label/title of this node
{this_node_entry_id}5 The entry_id of the entry associated with this node
{this_node_template_id}5 The id of the template associated with this node
{this_node_status}closed The status of the entry associated with this node
{this_node_highlight}009933 The hex value of the status of the entry associated with this node
{this_node_title}About Foo Corp The title of the entry associated with this node
{this_node_url_title}about-us The url_title of the entry associated with this node
{this_node_entry_date}1310087884 The entry_date of the entry associated with this node
{this_node_level}2 The level/depth of this node
{this_node_level+1}3 The level/depth of this node + 1
{this_node_level+2}4 The level/depth of this node + 2
{this_node_level-1}1 The level/depth of this node - 1
{this_node_level-2}0 The level/depth of this node - 2
{this_node_has_children}1 Returns true if this node has children
{this_node_url}http://example.com/foo The url of this node
{this_my_custom_taxonomy_field}Allo Allo The field value of your node's Taxonomy custom field
{this_parent_parent_node_id}5 The id of the parent's parent node
{this_parent_node_lft}5 The id of the parent's parent node
{this_parent_node_lft}2 The 'lft' value of this node's parent
{this_parent_node_rgt}5 The 'rgt' value of this node's parent
{this_parent_node_label}About Us The label/title of this node's parent
{this_parent_node_entry_id}5 The entry_id of the entry associated with this node's parent
{this_parent_node_template_id}5 The id of the template associated with this node's parent
{this_parent_node_status}closed The status of the entry associated with this node's parent
{this_parent_node_highlight}009933 The hex value of the status of the entry associated with this node's parent
{this_parent_node_title}About Foo Corp The title of the entry associated with this node's parent
{this_parent_node_url_title}about-us The url_title of the entry associated with this node's parent
{this_parent_node_entry_date}1310087884 The entry_date of the entry associated with this node's parent
{this_parent_node_level}2 The level/depth of this node's parent
{this_parent_node_level+1}3 The level/depth of this node's parent + 1
{this_parent_node_level+2}4 The level/depth of this node's parent + 2
{this_parent_node_level-1}1 The level/depth of this node's parent - 1
{this_parent_node_level-2}0 The level/depth of this node's parent - 2
{this_parent_node_has_children}1 Returns true if this node's parent has children (as if it wouldn't!)
{this_parent_node_url}http://example.com/foo The url of this node's parent
{this_parent_my_custom_taxonomy_field}Allo Allo The field value of your node's parent Taxonomy custom field

As captured 20 September 2021 · The archived original