eZPublish(LegacyStack)  5.1
eZTemplateSwitchFunction Class Reference

Handles conditional output in templates using function "switch". More...

Public Member Functions

 attributeList ()
 
 eZTemplateSwitchFunction ()
 
 functionList ()
 
 functionTemplateHints ()
 
 hasChildren ()
 
 process ($tpl, &$textElements, $functionName, $functionChildren, $functionParameters, $functionPlacement, $rootNamespace, $currentNamespace)
 
 templateNodeCaseTransformation ($tpl, &$newNodes, &$caseNodes, &$caseCounter, &$node, $privateData)
 
 templateNodeTransformation ($functionName, &$node, $tpl, $parameters, $privateData)
 

Public Attributes

 $SwitchName
 The name of the switch function. More...
 

Detailed Description

Handles conditional output in templates using function "switch".

This allows for writing switch/case sentences (similar to if/else if/else) which you normally find in programming languages. With this you can display text depending on a certain template variable.

// Example template code
{* Matches $a against $b or $c *}
{switch match=$a}
{case match=$b}
Matched $b
{/case}
{case match=$c}
Matched $c
{/case}
{/switch}

TODO: Add support for custom operations when matching {case process=$match|gt(5)} Matched $c {/case}

Member Function Documentation

eZTemplateSwitchFunction::attributeList ( )

Returns the attribute list which is case.

eZTemplateSwitchFunction::eZTemplateSwitchFunction ( )

Initializes the function with the name $name, default is "switch".

eZTemplateSwitchFunction::functionList ( )

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

eZTemplateSwitchFunction::functionTemplateHints ( )
eZTemplateSwitchFunction::hasChildren ( )

Returns true.

eZTemplateSwitchFunction::process (   $tpl,
$textElements,
  $functionName,
  $functionChildren,
  $functionParameters,
  $functionPlacement,
  $rootNamespace,
  $currentNamespace 
)

Processes the function with all it's children.

eZTemplateSwitchFunction::templateNodeCaseTransformation (   $tpl,
$newNodes,
$caseNodes,
$caseCounter,
$node,
  $privateData 
)
eZTemplateSwitchFunction::templateNodeTransformation (   $functionName,
$node,
  $tpl,
  $parameters,
  $privateData 
)

Member Data Documentation

eZTemplateSwitchFunction::$SwitchName

The name of the switch function.


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