📚 Looking for current Exponential documentation? This site contains legacy SDK & API reference docs (eZ Publish era). For up-to-date 2026 product documentation, visit doc.exponential.earth.

  class / eZTemplateSwitchFunction  

eZTemplateSwitchFunction Class Reference
[Template functions]

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

List of all members.


Public Methods

 eZTemplateSwitchFunction ($name="switch")
& functionList ()
 attributeList ()
 process (&$tpl,&$textElements,$functionName,$functionChildren,$functionParameters,$functionPlacement,$rootNamespace,$currentNamespace)
 hasChildren ()

Public Attributes

 Name
 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}

Definition at line eztemplateswitchfunction.php.


Constructor & Destructor Documentation

eZTemplateSwitchFunction::eZTemplateSwitchFunction (  $    name = "switch" ) 
 

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

Definition at line eztemplateswitchfunction.php.

References Name.


Member Function Documentation

eZTemplateSwitchFunction::attributeList (    ) 
 

Returns the attribute list which is case.

Definition at line eztemplateswitchfunction.php.

& eZTemplateSwitchFunction::functionList (    ) 
 

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

Definition at line eztemplateswitchfunction.php.

eZTemplateSwitchFunction::hasChildren (    ) 
 

Returns true.

Definition at line eztemplateswitchfunction.php.

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

Processes the function with all it's children.

Definition at line eztemplateswitchfunction.php.


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

Exponential Copyright © 1998 - 2026 7x