Learning: $node

« 
Previous article
|
|

When the system uses a node template, the template has access to the $node variable.

$node is set by the system and contains an object that represented the requested node.

$node allows you to extract and display information about the specific node and content object associated with the node. This is how you access the actual information contained in the object.

Some common attributes of a node would be name, published, who created it, who last modified it.

Eg. {$node.name|wash}

This will get the name of the node and clean it (wash removes any characters that could affect the html).

You can also access all the attributes of the content object associated with the node.

Eg. {$node.object.data_map.address}

This command will return the content contained with the object attribute called “address”