Exponential 6.0.13 Exponential Enterprise Open Source CMS - PHP Class Reference

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

Conditional execution in templates. 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 = 'if'

## Detailed Description

Conditional execution in templates.

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

Syntax:

{if <condition>}
[{elseif <condition>}]
[{else}]
{/if}

Example:

{if eq( $var, true() )}
Hello world
{else}
No world here, move along.
{/if}

Definition at line 37 of file eztemplateiffunction.php.

## Member Function Documentation

## ◆ attributeList()

eZTemplateIfFunction::attributeList | ( |  | ) |

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

Definition at line 56 of file eztemplateiffunction.php.

## ◆ functionList()

eZTemplateIfFunction::functionList | ( |  | ) |

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

Definition at line 44 of file eztemplateiffunction.php.

References FUNCTION_NAME.

## ◆ functionTemplateHints()

eZTemplateIfFunction::functionTemplateHints | ( |  | ) |

Returns the array with hits for the template compiler.

Definition at line 66 of file eztemplateiffunction.php.

References FUNCTION_NAME.

## ◆ hasChildren()

eZTemplateIfFunction::hasChildren | ( |  | ) |

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

Definition at line 254 of file eztemplateiffunction.php.

## ◆ process()

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

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

Definition at line 154 of file eztemplateiffunction.php.

References eZTemplate\NODE_FUNCTION, and eZDebug\writeError().

## ◆ templateNodeTransformation()

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

Compiles the function and its children into PHP code.

Definition at line 77 of file eztemplateiffunction.php.

References eZTemplateNodeTool\createCodePieceNode(), eZTemplateNodeTool\createSpacingDecreaseNode(), eZTemplateNodeTool\createSpacingIncreaseNode(), eZTemplateNodeTool\createVariableNode(), eZTemplateNodeTool\createVariableUnsetNode(), eZTemplateNodeTool\extractFunctionNodeChildren(), eZTemplateNodeTool\extractFunctionNodePlacement(), eZTemplate\NODE_FUNCTION, and eZTemplateCompiler\processElementTransformationList().

## Member Data Documentation

## ◆ FUNCTION_NAME

const eZTemplateIfFunction::FUNCTION_NAME = 'if'

Definition at line 39 of file eztemplateiffunction.php.

Referenced by functionList(), and functionTemplateHints().

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

- eztemplateiffunction.php

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