Skip to the content
Documentation
Help Start
Reading in:
  • German: 9,059 of 9,059 pages
About the help in other languages
All help pages

Attributes and dot notation

Reading data in templates with the dot: attributes of objects ($node.name), keys of hashes, items of arrays, chained lookups ($node.data_map.image.content), dynamic keys, and how to see what attributes an object has…

Download as PDF

Address: https://doc.exponential.earth/exphelp/viewer/help/designers/templates/attributes-and-dot-notation.md

On this page

Attributes and dot notation

This page is for designers who read values from nodes, objects and hashes. The dot is the template language's one way to look inside a value.

Contents

  1. Objects, hashes and arrays
  2. Chains
  3. Dynamic keys
  4. What does this object have?
  5. Missing attributes

Objects, hashes and arrays

{$node.name}                   {* attribute of an object *}
{$settings.color}              {* key of a hash *}
{$items.0.name}                {* first item of an array, then its attribute *}

Kernel objects (nodes, objects, attributes, users) expose a fixed list of attributes; a node, for example, has name, url_alias, data_map, children, parent, path, class_identifier, can_edit and more (Nodes, objects and attributes).

Chains

{$node.data_map.image.content['large'].url}
{$node.object.owner.name}
{$node.parent.name}

Each step is a lookup; some (like children or parent) run a database query. Store a value you use several times in a variable.

Dynamic keys

When the key is in a variable, use brackets:

{def $field = 'intro'}
{$node.data_map[$field].has_content}
{$image_content[$image_class].url}

What does this object have?

The attribute and dump operators print the attributes of a value (lib/eztemplate/classes/eztemplateattributeoperator.php):

{$node|attribute( show, 1 )}
{$node.data_map|dump( show, 2 )}

show prints values too; the number is the depth. Use them only on a test siteaccess and remove them before committing: they print internal data.

Missing attributes

Reading an attribute that does not exist prints nothing and writes a warning to the debug output. Test optional values first:

{if is_set( $node.data_map.subtitle )}...{/if}
{if $node.data_map.image.has_content}...{/if}

Become an Exponential Partner

Partners share their information, provide funding, contribute back and develop the products with us, and that is how Exponential grows. A partner website and dashboard are planned for mid-2027: please become a partner today to speed up our growth rate and land new features faster.

Something wrong on this page? Report an error

Documentation license

This documentation is free documentation, licensed under the GNU Free Documentation License 1.3 or later.

Exponential Copyright © 1998-2026 Exponential Foundation and 7x