📚 Looking for current Exponential documentation? This site contains legacy SDK & API reference docs (eZ Publish era). For up-to-date 2026 product documentation, visit doc.exponential.earth.

  eztemplate / basic_namespaces  

<< Types  Attributes >> 

Namespaces

Namespaces allow separation of variables with the same name. This is most useful for functions that create variables on the fly (e.g. section).

Templates have two namespaces, one is called the root namespace and defines the global namespace for one template, the other is the current namespace. The current namespace will start out being the same as the root but will change when a function is used which has namespace support. The current namespace is used by functions to create new variables and avoid clashes, while the root namespace is used to lookup the correct variable.

The following table displays how the root and current namespace behaves.

CodeRoot  Current
{$variable}
First First
{section name=Space}
First First:Space
  {$variable}
First First:Space
  {$First:Space:item}
First First:Space
  {section name=Room}
First First:Space:Room
    {$First:Space:Room:item}
First First:Space:Room
  {/section}
First First:Space
{/section}
First First

Relative and absolute addressing

To address a variable in the current namespace, you can use a $: (dollar colon). Use $# (dollar hash) to address a variable in the root namespace (absolute addressing).

{let var='hi all!'}
  {section name=Space}
    {* Local namespace *}
    {$Space:item.first}
    {* Also local namespace *}
    {$:item.first}
    {* Root namespace *}
    {$#var}
  {/section}
{/let}

Exponential Copyright © 1998 - 2026 7x