Exponential 6.0.13 Exponential Enterprise Open Source CMS - PHP Class Reference

Public Member Functions | Public Attributes | Private Member Functions | List of all members
eZTemplateAttributeOperator Class Reference
Template system » Template operators

Display of variable attributes using operator "attribute" or dumps a variable using the operator "dump". More...

## Public Member Functions
| __construct ( $attributeName='attribute', $dumpName='dump')
| operatorList ()
| operatorTemplateHints ()
| namedParameterList ()
| namedParameterPerOperator ()
| modify ( $tpl, $operatorName, $operatorParameters, $rootNamespace, $currentNamespace, &$operatorValue, $namedParameters, $placement)

## Public Attributes
| $AttributeName
| $DumpName
| $Operators
| The array of operators, used for registering operators. More...

## Private Member Functions
| displayVariable (&$value, ezpAttributeOperatorFormatterInterface $formatter, $showValues, $max, $level, &$outputString)

## Detailed Description

Display of variable attributes using operator "attribute" or dumps a variable using the operator "dump".

This class allows for displaying template variable attributes. The display is recursive and the number of levels can be maximized.

The "attribute" operator can take three parameters. The first is whether to show variable values or not, default is to not show. The second is the maximum number of levels to recurse, if blank or omitted the maxium level is 2. The third is the type of display, if set to "text" the output is as pure text otherwise as html. The default output is configured in template.ini.

The "dump" operator does exactly what the "attribute" operator does with following exceptions:

- The default maximum number of levels to recurse is 1
- By default, it shows the values of arrays and object properties
- it can handle primitive variables and NULL values

// Example template code for operator 'attribute'
// Display attributes of $myvar
{$myvar|attribute}
// Display 2 levels of $tree
{$tree|attribute(show,2)}
// Display attributes and values of $item
{$item|attribute(show)}
// Example template code for operator 'dump'
// Dumps out $myvar - can handle primitive variables, arrays and objects.
// By default it shows array values or object properties.
{$myvar|dump()}
// Show 2 levels of $tree (default is 1)
{$tree|dump(show, 2)}

Definition at line 55 of file eztemplateattributeoperator.php.

## Constructor & Destructor Documentation

## ◆ __construct()

eZTemplateAttributeOperator::__construct | ( |  | $attributeName = `'attribute'`,
|  |  | $dumpName = `'dump'`
| ) |  |

Initializes the object with the name $attributeName, default is "attribute" and $dumpName, default is 'dump'

Parameters

  string | $attributeName |
  string | $dumpName |

Definition at line 65 of file eztemplateattributeoperator.php.

## Member Function Documentation

## ◆ displayVariable()

eZTemplateAttributeOperator::displayVariable | ( | & | $value,
|  | ezpAttributeOperatorFormatterInterface | $formatter,
|  |  | $showValues,
|  |  | $max,
|  |  | $level,
|  | & | $outputString
| ) |  |
| private

Helper function for recursive display of attributes. $value is the current variable, $as_html is true if display as html, $max is the maximum number of levels, $cur_level the current level and $outputString is the output text which the function adds to.

Definition at line 156 of file eztemplateattributeoperator.php.

Referenced by modify().

## ◆ modify()

eZTemplateAttributeOperator::modify | ( |  | $tpl,
|  |  | $operatorName,
|  |  | $operatorParameters,
|  |  | $rootNamespace,
|  |  | $currentNamespace,
|  | & | $operatorValue,
|  |  | $namedParameters,
|  |  | $placement
| ) |  |

Display the variable.

Definition at line 126 of file eztemplateattributeoperator.php.

References displayVariable().

## ◆ namedParameterList()

eZTemplateAttributeOperator::namedParameterList | ( |  | ) |

See eZTemplateOperator::namedParameterList()

Definition at line 93 of file eztemplateattributeoperator.php.

## ◆ namedParameterPerOperator()

eZTemplateAttributeOperator::namedParameterPerOperator | ( |  | ) |

Returns
  true to tell the template engine that the parameter list exists per operator type.

Definition at line 118 of file eztemplateattributeoperator.php.

## ◆ operatorList()

eZTemplateAttributeOperator::operatorList | ( |  | ) |

Returns the template operators.

Definition at line 75 of file eztemplateattributeoperator.php.

References $Operators.

## ◆ operatorTemplateHints()

eZTemplateAttributeOperator::operatorTemplateHints | ( |  | ) |

Definition at line 80 of file eztemplateattributeoperator.php.

## Member Data Documentation

## ◆ $AttributeName

eZTemplateAttributeOperator::$AttributeName

Definition at line 57 of file eztemplateattributeoperator.php.

## ◆ $DumpName

eZTemplateAttributeOperator::$DumpName

Definition at line 58 of file eztemplateattributeoperator.php.

## ◆ $Operators

eZTemplateAttributeOperator::$Operators

The array of operators, used for registering operators.

Definition at line 188 of file eztemplateattributeoperator.php.

Referenced by operatorList().

The documentation for this class was generated from the following file:

- eztemplateattributeoperator.php

Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.