Exponential 6.0.13 Exponential Enterprise Open Source CMS - PHP Class Reference

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

Sets template variables code using function 'set'. More...

## Public Member Functions
| __construct ( $setName='set', $letName='let', $defaultName='default')
| functionList ()
| functionTemplateHints ()
| templateNodeTransformation ( $functionName, &$node, $tpl, $parameters, $privateData)
| templateHookProcess ( $functionName, $functionHookName, $functionHook, $tpl, $functionParameters, $functionPlacement, $rootNamespace, $currentNamespace)
| defineVariables ( $tpl, $functionParameters, $functionPlacement, $name, $rootNamespace, &$currentNamespace)
| createDefaultVariables ( $tpl, $functionParameters, $functionPlacement, $name, $rootNamespace, &$currentNamespace)
| cleanupVariables ( $tpl, $rootNamespace, &$currentNamespace, $setData)
| process ( $tpl, &$textElements, $functionName, $functionChildren, $functionParameters, $functionPlacement, $rootNamespace, $currentNamespace)
| hasChildren ()

## Public Attributes
const | SCOPE_RELATIVE = 1
const | SCOPE_ROOT = 2
const | SCOPE_GLOBAL = 3
| $SetName
| The name of the set function. More...
| $LetName
| $DefaultName

## Detailed Description

Sets template variables code using function 'set'.

Allows for setting template variables from templates using a template function. This is mainly used for optimizations.

The let function will define new variables and initialize them with a value while set only sets values to existing variables. The let function is also scoped with children which means that the variables are unset when the children are processed.

// Example template code
{let object=$item1 some_text='abc' integer=1}
{set object=$item2 some_text='def'}
{/let}
{set name=NewNamespace place='/etc/test.tpl'}

Definition at line 36 of file eztemplatesetfunction.php.

## Constructor & Destructor Documentation

## ◆ __construct()

eZTemplateSetFunction::__construct | ( |  | $setName = `'set'`,
|  |  | $letName = `'let'`,
|  |  | $defaultName = `'default'`
| ) |  |

Initializes the function with the function names $setName and $letName.

Parameters

  string | $setName |
  string | $letName |
  string | $defaultName |

Definition at line 49 of file eztemplatesetfunction.php.

## Member Function Documentation

## ◆ cleanupVariables()

eZTemplateSetFunction::cleanupVariables | ( |  | $tpl,
|  |  | $rootNamespace,
|  | & | $currentNamespace,
|  |  | $setData
| ) |  |

Definition at line 253 of file eztemplatesetfunction.php.

Referenced by process().

## ◆ createDefaultVariables()

eZTemplateSetFunction::createDefaultVariables | ( |  | $tpl,
|  |  | $functionParameters,
|  |  | $functionPlacement,
|  |  | $name,
|  |  | $rootNamespace,
|  | & | $currentNamespace
| ) |  |

Definition at line 225 of file eztemplatesetfunction.php.

Referenced by process().

## ◆ defineVariables()

eZTemplateSetFunction::defineVariables | ( |  | $tpl,
|  |  | $functionParameters,
|  |  | $functionPlacement,
|  |  | $name,
|  |  | $rootNamespace,
|  | & | $currentNamespace
| ) |  |

Definition at line 190 of file eztemplatesetfunction.php.

Referenced by process().

## ◆ functionList()

eZTemplateSetFunction::functionList | ( |  | ) |

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

Definition at line 59 of file eztemplatesetfunction.php.

## ◆ functionTemplateHints()

eZTemplateSetFunction::functionTemplateHints | ( |  | ) |

Definition at line 64 of file eztemplatesetfunction.php.

## ◆ hasChildren()

eZTemplateSetFunction::hasChildren | ( |  | ) |

Returns false, telling the template parser that this is a single tag.

Definition at line 369 of file eztemplatesetfunction.php.

## ◆ process()

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

Loads the file specified in the parameter 'uri' with namespace 'name'.

Definition at line 266 of file eztemplatesetfunction.php.

References cleanupVariables(), createDefaultVariables(), defineVariables(), SCOPE_GLOBAL, SCOPE_RELATIVE, and SCOPE_ROOT.

## ◆ templateHookProcess()

eZTemplateSetFunction::templateHookProcess | ( |  | $functionName,
|  |  | $functionHookName,
|  |  | $functionHook,
|  |  | $tpl,
|  |  | $functionParameters,
|  |  | $functionPlacement,
|  |  | $rootNamespace,
|  |  | $currentNamespace
| ) |  |

Definition at line 185 of file eztemplatesetfunction.php.

## ◆ templateNodeTransformation()

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

Definition at line 83 of file eztemplatesetfunction.php.

References eZTemplateNodeTool\createNamespaceChangeNode(), eZTemplateNodeTool\createNamespaceRestoreNode(), eZTemplateNodeTool\createVariableNode(), eZTemplateNodeTool\createVariableUnsetNode(), eZTemplateNodeTool\elementConstantValue(), eZTemplateNodeTool\extractFunctionNodeChildren(), eZTemplateNodeTool\extractFunctionNodeParameters(), eZTemplateNodeTool\extractFunctionNodePlacement(), eZTemplateNodeTool\isConstantElement(), eZTemplate\NAMESPACE_SCOPE_GLOBAL, eZTemplate\NAMESPACE_SCOPE_LOCAL, and eZTemplate\NAMESPACE_SCOPE_RELATIVE.

## Member Data Documentation

## ◆ $DefaultName

eZTemplateSetFunction::$DefaultName

Definition at line 379 of file eztemplatesetfunction.php.

## ◆ $LetName

eZTemplateSetFunction::$LetName

Definition at line 378 of file eztemplatesetfunction.php.

## ◆ $SetName

eZTemplateSetFunction::$SetName

The name of the set function.

Definition at line 377 of file eztemplatesetfunction.php.

## ◆ SCOPE_GLOBAL

const eZTemplateSetFunction::SCOPE_GLOBAL = 3

Definition at line 40 of file eztemplatesetfunction.php.

Referenced by process().

## ◆ SCOPE_RELATIVE

const eZTemplateSetFunction::SCOPE_RELATIVE = 1

Definition at line 38 of file eztemplatesetfunction.php.

Referenced by process().

## ◆ SCOPE_ROOT

const eZTemplateSetFunction::SCOPE_ROOT = 2

Definition at line 39 of file eztemplatesetfunction.php.

Referenced by process().

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

- eztemplatesetfunction.php

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