eZ Publish  [trunk]
eZTemplateSwitchFunction Class Reference

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

List of all members.

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.

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}

Definition at line 42 of file eztemplateswitchfunction.php.


Member Function Documentation

Returns the attribute list which is case.

Definition at line 72 of file eztemplateswitchfunction.php.

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

Definition at line 47 of file eztemplateswitchfunction.php.

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

Definition at line 55 of file eztemplateswitchfunction.php.

Returns true.

Definition at line 362 of file eztemplateswitchfunction.php.

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

Processes the function with all it's children.

Definition at line 212 of file eztemplateswitchfunction.php.

eZTemplateSwitchFunction::templateNodeCaseTransformation ( tpl,
&$  newNodes,
&$  caseNodes,
&$  caseCounter,
&$  node,
privateData 
)

Definition at line 77 of file eztemplateswitchfunction.php.

Referenced by templateNodeTransformation().

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

Definition at line 136 of file eztemplateswitchfunction.php.


Member Data Documentation

eZTemplateSwitchFunction::$SwitchName

The name of the switch function.

Definition at line 368 of file eztemplateswitchfunction.php.


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