Exponential 6.0.13 Exponential Enterprise Open Source CMS - PHP Class Reference

Public Member Functions | Public Attributes | List of all members
eZTemplateDefFunction Class Reference
Template system » Template functions

Allows to define/undefine template variables in any place. More...

## Public Member Functions
| functionList ()
| attributeList ()
| functionTemplateHints ()
| templateNodeTransformation ( $functionName, &$node, $tpl, &$parameters, $privateData)
| process ( $tpl, &$textElements, $functionName, $functionChildren, $functionParameters, $functionPlacement, $rootNamespace, $currentNamespace)
| hasChildren ()

## Public Attributes
const | DEF_FUNCTION_NAME = 'def'
const | UNDEF_FUNCTION_NAME = 'undef'

## Detailed Description

Allows to define/undefine template variables in any place.

This class allows to execute on of two or more code pieces depending on a condition.

Syntax:

{def $var1=<value1> [$var2=<value2> ...]}

Example:

{def $i=10 $j=20}
{def $s1='hello' $s2='world'}
...
{set $i=$i+1}
...
{undef $i}
{undef $s1 $s2}
{undef}

Definition at line 37 of file eztemplatedeffunction.php.

## Member Function Documentation

## ◆ attributeList()

eZTemplateDefFunction::attributeList | ( |  | ) |

Returns the attribute list which is 'delimiter', 'elseif' and 'else'. key: parameter name value: can have children

Definition at line 56 of file eztemplatedeffunction.php.

## ◆ functionList()

eZTemplateDefFunction::functionList | ( |  | ) |

Returns an array of the function names, required for eZTemplate::registerFunctions.

Definition at line 45 of file eztemplatedeffunction.php.

References DEF_FUNCTION_NAME, and UNDEF_FUNCTION_NAME.

## ◆ functionTemplateHints()

eZTemplateDefFunction::functionTemplateHints | ( |  | ) |

Returns the array with hits for the template compiler.

Definition at line 65 of file eztemplatedeffunction.php.

References DEF_FUNCTION_NAME, and UNDEF_FUNCTION_NAME.

## ◆ hasChildren()

eZTemplateDefFunction::hasChildren | ( |  | ) |

Returns false, telling the template parser that the function cannot have children.

Definition at line 171 of file eztemplatedeffunction.php.

## ◆ process()

eZTemplateDefFunction::process | ( |  | $tpl,
|  | & | $textElements,
|  |  | $functionName,
|  |  | $functionChildren,
|  |  | $functionParameters,
|  |  | $functionPlacement,
|  |  | $rootNamespace,
|  |  | $currentNamespace
| ) |  |

Actually executes the function (in processed mode).

Definition at line 127 of file eztemplatedeffunction.php.

References DEF_FUNCTION_NAME, and UNDEF_FUNCTION_NAME.

## ◆ templateNodeTransformation()

eZTemplateDefFunction::templateNodeTransformation | ( |  | $functionName,
|  | & | $node,
|  |  | $tpl,
|  | & | $parameters,
|  |  | $privateData
| ) |  |

Compiles the function into PHP code.

Definition at line 80 of file eztemplatedeffunction.php.

References eZTemplateNodeTool\createCodePieceNode(), eZTemplateNodeTool\createVariableNode(), eZTemplateNodeTool\createVariableUnsetNode(), eZTemplateNodeTool\extractFunctionNodePlacement(), and eZTemplate\NAMESPACE_SCOPE_LOCAL.

## Member Data Documentation

## ◆ DEF_FUNCTION_NAME

const eZTemplateDefFunction::DEF_FUNCTION_NAME = 'def'

Definition at line 39 of file eztemplatedeffunction.php.

Referenced by functionList(), functionTemplateHints(), and process().

## ◆ UNDEF_FUNCTION_NAME

const eZTemplateDefFunction::UNDEF_FUNCTION_NAME = 'undef'

Definition at line 40 of file eztemplatedeffunction.php.

Referenced by functionList(), functionTemplateHints(), and process().

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

- eztemplatedeffunction.php

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