Caution: This documentation is for eZ Publish legacy, from version 3.x to 6.x.
For 5.x documentation covering Platform see eZ Documentation Center, for difference between legacy and Platform see 5.x Architecture overview.

dump

Summary

Makes it possible to inspect the contents of arrays, hashes and objects. Alias of attribute() available in 4.7 and higher which is simpler to use.

Usage

eZ Publish 4.7 and later
input|dump( [show_values [, level [, outputformat ] ] ] )

Parameters

NameTypeDescriptionRequired
show_values string Sets whether to extract values in addition to keys, names, etc. If "show" is passed, the values will be returned. Otherwise, the operator will not return any values. Default is "show" No.
level integer The number of levels that should be processed (default is 1). No.
outputformat string Specify output format. Default output format is 'html', but 'text' is also supported. Other custom output formats can be written. No.

Returns

A string (html or raw text depending on "outputformat") revealing information about the target.

Description

This operator is an alias of the attribute() operator and is available in 4.7 and higher.

This operator extracts all available keys, attribute names and/or methods that belong to the input parameter (must be either an object, an array or a hash). By default, the array keys, object attribute names and their types will be revealed. By passing "show" as the first parameter, the operator will also return the values. The second parameter can be used to control the number of levels/children that should be expanded and included in the result (the default setting is 2). A large level value may cause the system to be trapped in a recursive/infinite loop. The returned result is an HTML table containing the retrieved information. If "text()" is passed as the third parameter, the output will be a plain string instead of an HTML table. Please refer to the "Array and object inspection" section of the "Templates" chapter for more information about the use of this operator.

Examples

Example 1

{def $example=hash( 'Name',  'John Doe',
                    'Age',   24,
                    'Phone', '555-3212' )}
 
{$example|dump()}

The following output will be produced:

Attribute

Type

Name

string

Age

integer

Phone

string

Example 2

{def $example=hash( 'Name',  'Jane Doe',
                    'Age',   23,
                    'Phone', '555-3213' )}
 
{$example|dump( 'show' )}

The following output will be produced:

Attribute

Type

Value

Name

string

'Jane Doe'

Age

integer

23

Phone

string

'555-3213'

Example 3

{def $example=hash( 'Name',  'Jane Doe',
                    'Age',   25,
                    'Phone', '555-3213' )}
 
{$example|dump( 'something' )}

The following output will be produced:

Attribute

Type

Name

string

Age

integer

Phone

string

André R. (02/05/2012 10:52 am)

Andrea Melo (05/06/2012 11:50 am)

André R., Andrea Melo


Comments

There are no comments.