Learning: Learning: Template Debugging
Table of contents:
Attribute
Subject: Template debugging using template operator 'attribute'.
Template Operator: attribute
All eZ publish developers need to understand how to use the operator called attribute. Here are some example of it’s use:
{ $foo | attribute( show, 1 )}
These are some other commonly used examples of it’s syntax and usage.
{$foo|attribute(show)} {$foo|attribute(show,1)} {$foo|attribute(show,2)} {$foo|attribute(show,3)} {$foo|attribute(show,false())}
Production Debuging Tip
Use output your attribute show debug output while working on a production eZ publish installation inside of an html comment.
This provides for display of debug information within the html source code output in an html comment without displaying that same debug information to your web site's users.
<!-- {$myvariable|attribute(show,1)} -->
ez.no documentation
Checkout the eZ systems : eZ publish : Technical Manual : 3.8 Template Language : Array and Object inspection.
Sourced from from ez.no 3.4 docs
The template operator attribute can be used to generate a list of attributes from a template variable. You do that by:
{$myvariable|attribute}
i.e.
Variable: module_result.content
{$module_result.content|attribute(show, 1)}
Variable: node
{$node|attribute(show, 1)}
Variable: node.data_map
{$node.data_map|attribute(show, 1)}
Variable: node.object
{$node.object|attribute(show, 1)}
Variable: DesignKeys:used
{$DesignKeys:used|attribute(show, 1)}
This will generate a HTML table with all the attributes and their types. If a type is an array or a new object with attributes it will recursively display those as well until it has displayed 2 levels. Options
By supplying show as the first parameter you get the values of the attributes.
The second parameter determines how many levels it will expand, the default is 2. A value of false, means there is no level limit, this can cause the web server to crash if there are infinite loops in the attributes.
false()
The third controls whether the output should be in HTML or not. Pass false to it to get text output.
false()