Exponential 6.0.13 Exponential Enterprise Open Source CMS - PHP Class Reference

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

Advanced block handling. More...

## Public Member Functions
| __construct ( $blockName='set-block', $appendBlockName='append-block', $onceName='run-once')
| functionList ()
| functionTemplateHints ()
| templateNodeTransformation ( $functionName, &$node, $tpl, $parameters, $privateData)
| process ( $tpl, &$textElements, $functionName, $functionChildren, $functionParameters, $functionPlacement, $rootNamespace, $currentNamespace)
| resetFunction ( $functionName)
| placementKey ( $placement)
| hasPlacementKey ( $key)
| registerPlacementKey ( $key, $placement)
| hasChildren ()

## Public Attributes
const | SCOPE_RELATIVE = 1
const | SCOPE_ROOT = 2
const | SCOPE_GLOBAL = 3
| $BlockName
| $AppendBlockName
| $OnceName

## Detailed Description

Advanced block handling.

set-block Renders all it's children as text and sets it as a template variable. This is useful for allowing one template to return multiple text portions, for instance an email template could set subject as a block and return the rest as body.

{set-block name=Space scope=global variable=text}
{$item} - {$item2}
{/set-block}

append-block Similar to set-block but will make the variable an array where each append-block adds an item.

{append-block scope=global variable=extra_header_data}
<script language=jscript src={"/extension/xmleditor/dhtml/ezeditor.js"|ezroot}></script>
<link rel="stylesheet" type="text/css" href={"/extension/xmleditor/dhtml/toolbar.css"|ezroot}>
{/append-block}

run-once Makes sure that the block is run only once.

{run-once}
<p>This appears only one time</p>
{/run-once}

Definition at line 49 of file eztemplateblockfunction.php.

## Constructor & Destructor Documentation

## ◆ __construct()

eZTemplateBlockFunction::__construct | ( |  | $blockName = `'set-block'`,
|  |  | $appendBlockName = `'append-block'`,
|  |  | $onceName = `'run-once'`
| ) |  |

Parameters

  string | $blockName |
  string | $appendBlockName |
  string | $onceName |

Definition at line 60 of file eztemplateblockfunction.php.

## Member Function Documentation

## ◆ functionList()

eZTemplateBlockFunction::functionList | ( |  | ) |

Returns an array containing the name of the block function, default is "block". The name is specified in the constructor.

Definition at line 73 of file eztemplateblockfunction.php.

## ◆ functionTemplateHints()

eZTemplateBlockFunction::functionTemplateHints | ( |  | ) |

Definition at line 78 of file eztemplateblockfunction.php.

## ◆ hasChildren()

eZTemplateBlockFunction::hasChildren | ( |  | ) |

Returns true.

Definition at line 341 of file eztemplateblockfunction.php.

## ◆ hasPlacementKey()

eZTemplateBlockFunction::hasPlacementKey | ( |  | $key | ) |

Returns
  true if the placement key is registered which means that the block has already been run.

Definition at line 325 of file eztemplateblockfunction.php.

Referenced by process().

## ◆ placementKey()

eZTemplateBlockFunction::placementKey | ( |  | $placement | ) |

Generates an md5 key from the start, stop and file of the template function and returns it.

Returns
  false if the key could not be made.

Definition at line 308 of file eztemplateblockfunction.php.

Referenced by process(), and templateNodeTransformation().

## ◆ process()

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

Processes the function with all it's children.

Definition at line 190 of file eztemplateblockfunction.php.

References hasPlacementKey(), placementKey(), registerPlacementKey(), SCOPE_GLOBAL, SCOPE_RELATIVE, and SCOPE_ROOT.

## ◆ registerPlacementKey()

eZTemplateBlockFunction::registerPlacementKey | ( |  | $key,
|  |  | $placement
| ) |  |

Registers the placement key $key with the data $placement.

Definition at line 333 of file eztemplateblockfunction.php.

Referenced by process().

## ◆ resetFunction()

eZTemplateBlockFunction::resetFunction | ( |  | $functionName | ) |

Definition at line 296 of file eztemplateblockfunction.php.

## ◆ templateNodeTransformation()

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

Definition at line 96 of file eztemplateblockfunction.php.

References eZTemplateNodeTool\createAssignFromOutputVariableNode(), eZTemplateNodeTool\createCodePieceNode(), eZTemplateNodeTool\createOutputVariableDecreaseNode(), eZTemplateNodeTool\createOutputVariableIncreaseNode(), eZTemplateNodeTool\createSpacingDecreaseNode(), eZTemplateNodeTool\createSpacingIncreaseNode(), eZTemplateNodeTool\createVariableElement(), eZTemplateNodeTool\createVariableNode(), eZTemplateNodeTool\createVariableUnsetNode(), eZTemplateNodeTool\elementConstantValue(), eZTemplateNodeTool\extractFunctionNodeChildren(), eZTemplateNodeTool\extractFunctionNodePlacement(), eZTemplateNodeTool\isConstantElement(), eZTemplate\NAMESPACE_SCOPE_GLOBAL, eZTemplate\NAMESPACE_SCOPE_LOCAL, eZTemplate\NAMESPACE_SCOPE_RELATIVE, and placementKey().

## Member Data Documentation

## ◆ $AppendBlockName

eZTemplateBlockFunction::$AppendBlockName

Definition at line 349 of file eztemplateblockfunction.php.

## ◆ $BlockName

eZTemplateBlockFunction::$BlockName

Name of the function

Definition at line 348 of file eztemplateblockfunction.php.

## ◆ $OnceName

eZTemplateBlockFunction::$OnceName

Definition at line 350 of file eztemplateblockfunction.php.

## ◆ SCOPE_GLOBAL

const eZTemplateBlockFunction::SCOPE_GLOBAL = 3

Definition at line 53 of file eztemplateblockfunction.php.

Referenced by process().

## ◆ SCOPE_RELATIVE

const eZTemplateBlockFunction::SCOPE_RELATIVE = 1

Definition at line 51 of file eztemplateblockfunction.php.

Referenced by process().

## ◆ SCOPE_ROOT

const eZTemplateBlockFunction::SCOPE_ROOT = 2

Definition at line 52 of file eztemplateblockfunction.php.

Referenced by process().

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

- eztemplateblockfunction.php

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