Exponential 6.0.13 Exponential Enterprise Open Source CMS - PHP Class Reference

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

FOREACH loop. 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 | FUNCTION_NAME = 'foreach'

## Detailed Description

FOREACH loop.

Syntax:

{foreach <array> as [$keyVar =>] $itemVar
[sequence <array> as $sequenceVar]
[offset <offset>]
[max <max>]
[reverse]}
[{delimiter}...{/delimiter}]
[{break}]
[{continue}]
[{skip}]
{/foreach}

Example:

{foreach $objects as $object}
<tr>
{foreach $object.nodes as $node sequence array(dark,light) as $class}
<td class=$class>
{$node.name|wash}
</td>
{/foreach}
</tr>
{/foreach}

Definition at line 45 of file eztemplateforeachfunction.php.

## Member Function Documentation

## ◆ attributeList()

eZTemplateForeachFunction::attributeList | ( |  | ) |

Returns the attribute list. key: parameter name value: can have children

Definition at line 63 of file eztemplateforeachfunction.php.

## ◆ functionList()

eZTemplateForeachFunction::functionList | ( |  | ) |

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

Definition at line 52 of file eztemplateforeachfunction.php.

References FUNCTION_NAME.

## ◆ functionTemplateHints()

eZTemplateForeachFunction::functionTemplateHints | ( |  | ) |

Returns the array with hits for the template compiler.

Definition at line 75 of file eztemplateforeachfunction.php.

References FUNCTION_NAME.

## ◆ hasChildren()

eZTemplateForeachFunction::hasChildren | ( |  | ) |

Returns true, telling the template parser that the function can have children.

Definition at line 387 of file eztemplateforeachfunction.php.

## ◆ process()

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

Actually executes the function and its children (in processed mode).

Definition at line 250 of file eztemplateforeachfunction.php.

References FUNCTION_NAME.

## ◆ templateNodeTransformation()

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

Compiles the function and its children into PHP code.

Definition at line 86 of file eztemplateforeachfunction.php.

References eZTemplateNodeTool\createCodePieceNode(), eZTemplateNodeTool\createSpacingDecreaseNode(), eZTemplateNodeTool\createSpacingIncreaseNode(), eZTemplateNodeTool\createVariableNode(), eZTemplateNodeTool\createVariableUnsetNode(), eZTemplateNodeTool\extractFunctionNodePlacement(), and FUNCTION_NAME.

## Member Data Documentation

## ◆ FUNCTION_NAME

const eZTemplateForeachFunction::FUNCTION_NAME = 'foreach'

Definition at line 47 of file eztemplateforeachfunction.php.

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

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

- eztemplateforeachfunction.php

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