Class

eZTemplate

class eZTemplate

Constants

RESOURCE_FETCH

RESOURCE_QUERY

ELEMENT_TEXT

ELEMENT_SINGLE_TAG

ELEMENT_NORMAL_TAG

ELEMENT_END_TAG

ELEMENT_VARIABLE

ELEMENT_COMMENT

NODE_ROOT

NODE_TEXT

NODE_VARIABLE

NODE_FUNCTION

NODE_OPERATOR

NODE_INTERNAL

NODE_INTERNAL_CODE_PIECE

NODE_INTERNAL_VARIABLE_SET

NODE_INTERNAL_VARIABLE_UNSET

NODE_INTERNAL_NAMESPACE_CHANGE

NODE_INTERNAL_NAMESPACE_RESTORE

NODE_INTERNAL_WARNING

NODE_INTERNAL_ERROR

NODE_INTERNAL_RESOURCE_ACQUISITION

NODE_OPTIMIZED_RESOURCE_ACQUISITION

NODE_INTERNAL_OUTPUT_ASSIGN

NODE_INTERNAL_OUTPUT_READ

NODE_INTERNAL_OUTPUT_INCREASE

NODE_INTERNAL_OUTPUT_DECREASE

NODE_INTERNAL_OUTPUT_SPACING_INCREASE

NODE_INTERNAL_SPACING_DECREASE

NODE_OPTIMIZED_INIT

NODE_USER_CUSTOM

TYPE_VOID

TYPE_STRING

TYPE_NUMERIC

TYPE_IDENTIFIER

TYPE_VARIABLE

TYPE_ATTRIBUTE

TYPE_OPERATOR

TYPE_BOOLEAN

TYPE_ARRAY

TYPE_DYNAMIC_ARRAY

TYPE_INTERNAL

TYPE_INTERNAL_CODE_PIECE

TYPE_PHP_VARIABLE

TYPE_OPTIMIZED_NODE

TYPE_OPTIMIZED_ARRAY_LOOKUP

TYPE_OPTIMIZED_CONTENT_CALL

TYPE_OPTIMIZED_ATTRIBUTE_LOOKUP

TYPE_INTERNAL_STOP

TYPE_STRING_BIT

TYPE_NUMERIC_BIT

TYPE_IDENTIFIER_BIT

TYPE_VARIABLE_BIT

TYPE_ATTRIBUTE_BIT

TYPE_OPERATOR_BIT

TYPE_NONE

TYPE_ALL

TYPE_BASIC

TYPE_MODIFIER_MASK

NAMESPACE_SCOPE_GLOBAL

NAMESPACE_SCOPE_LOCAL

NAMESPACE_SCOPE_RELATIVE

DEBUG_INTERNALS

FILE_ERRORS

Properties

$Resources
$DefaultResource
$Text
$IncludeText
$IncludeOutput
$TimeStamp
$LDelim
$RDelim
$Tree
$Variables
$LocalVariablesNamesStack
$CurrentLocalVariablesNames
$Operators
$Functions
$FunctionAttributes
$Literals
$ShowDetails
$IsCachingAllowed
$ErrorLog
$WarningLog
$AutoloadPathList
$Level
$MaxLevel
$TemplatesUsageStatistics
$ForeachCounter
$ForCounter
$WhileCounter
$DoCounter
$ElseifCounter
$TestCompile

Methods

__construct()

Intializes the template with left and right delimiters being { and }, and a file resource.

leftDelimiter()

rightDelimiter()

setLeftDelimiter($delim)

setRightDelimiter($delim)

display($template = false, $extraParameters = false)

createLocalVariablesList()

hasLocalVariable($varName, $rootNamespace)

setLocalVariable($varName, $varValue, $rootNamespace)

unsetLocalVariable($varName, $rootNamespace)

unsetLocalVariables()

destroyLocalVariablesList()

fetch($template = false, $extraParameters = false, $returnResourceData = false)

process($root, $text, $rootNamespace, $currentNamespace)

processNode($node, $textElements, $rootNamespace, $currentNamespace)

processVariable($textElements, $variableData, $variablePlacement, $rootNamespace, $currentNamespace)

processFunction($functionName, $textElements, $functionChildren, $functionParameters, $functionPlacement, $rootNamespace, $currentNamespace)

fetchFunctionObject($functionName)

load($uri, $extraParameters = false, $returnResourceData = false)

parse($sourceText, $rootElement, $rootNamespace, $resourceData)

loadURIData($resourceObject, $uri, $resourceName, $template, $extraParameters, $displayErrors = true)

resourceData($resourceObject, $uri, $resourceName, $templateName)

loadURIRoot($uri, $displayErrors = true, $extraParameters)

processURI($uri, $displayErrors = true, $extraParameters, $textElements, $rootNamespace, $currentNamespace)

canCompileTemplate($resourceData, $extraParameters)

validateTemplateFile($file, $returnResourceData = false)

compileTemplateFile($file, $returnResourceData = false)

compileTemplate($resourceData, $extraParameters)

executeCompiledTemplate($resourceData, $textElements, $rootNamespace, $currentNamespace, $extraParameters)

resourceFor($uri, $res, $template)

resourceHandler($resourceName)

hasChildren($function, $functionName)

emptyVariable()

mergeNamespace($rootNamespace, $additionalNamespace)

elementValue($dataElements, $rootNamespace, $currentNamespace, $placement = false, $checkExistance = false, $checkForProxy = false)

expandAttributes($attributeList, $chooseText, $maxThreshold, $minThreshold = 1)

processOperator($operatorName, $operatorParameters, $rootNamespace, $currentNamespace, $valueData, $placement = false, $checkExistance = false)

attributeValue($data, $nspace)

variableText($var, $namespace = '', $attrs = array())

operatorParameterList($name)

doOperator($element, $namespace, $current_nspace, $value, $operatorName, $operatorParameters, $named_params)

doFunction($name, $func_obj, $nspace, $current_nspace)

setVariable(string $var, string $val, string $namespace = '', bool $scopeSafe = false)

Sets the template variable $var to the value $val.

unsetVariable(string $var, string $namespace = '')

Unsets the template variable $var.

bool hasVariable(string $var, string $namespace = '', array $attrs = null)

Returns true if the variable $var is set in namespace $namespace, if $attrs is supplied all attributes must exist for the function to return true.

string|array variable(string $var, string $namespace = '', array $attrs = null)

Returns the content of the variable $var using namespace $namespace, if $attrs is supplied the result of the attributes is returned.

variableAttribute($var, $attrs)

appendElement($text, $item, $nspace, $name)

appendElementText($textElements, $item, $nspace, $name)

appendDebugNodes($root, $resourceData)

registerFunctions($functionObject)

registerAutoloadFunctions($functionDefinition)

loadAndRegisterFunctions($functionDefinition)

registerFunctionsInternal($functionObject, $debug = false)

registerFunction($func_name, $func_obj)

registerLiteral($func_name)

unregisterLiteral($func_name)

registerAutoloadOperators($operatorDefinition)

loadAndRegisterOperators($operatorDefinition)

registerOperators($operatorObject)

registerOperatorsInternal($operatorObject, $debug = false)

registerOperator($op_name, $op_obj)

unregisterOperator($op_name)

registerFilter()

registerResource($res)

unregisterResource($res_name)

setShowDetails($show)

missingParameter($name, $param)

extraParameters($name, $count, $maxCount)

undefinedVariable($name, $var)

undefinedFunction($func_name)

placementText($placement = false)

warning($name, $txt, $placement = false)

error($name, $txt, $placement = false)

operatorInputSupported($operatorName)

setIncludeText($uri, $text)

setIncludeOutput($uri, $output)

autoloadPathList()

setAutoloadPathList($pathList)

autoload()

resetVariables()

resetElements()

reset()

errorCount()

hasErrors()

errorLog()

warningCount()

hasWarnings()

warningLog()

static eZTemplate instance()

Returns a shared instance of the eZTemplate class.

static eZTemplate factory()

Returns a shared instance of the eZTemplate class with default settings applied, like: - Autoload operators loaded - Debug mode set - eZTemplateDesignResource::instance registered

static  resetInstance()

Reset shared instance of the eZTemplate class and factory flag as used by {@link eZTemplate::instance()} and {@link eZTemplate::factory()}

eZINI ini()

Returns the eZINI object instance for the template.ini file.

isCachingAllowed()

setIsCachingAllowed($allowed)

setIsTemplatesUsageStatisticsEnabled($enabled)

appendTemplateToStatisticsIfNeeded($templateName, $templateFileName)

appendTemplateToStatistics($templateName, $templateFileName)

appendTemplateFetch($actualTemplateName)

resetErrorLog()

templateFetchList()

setCompileTest($val)

testCompile()

Details

at line 296
public __construct()

Intializes the template with left and right delimiters being { and }, and a file resource.

The literal tag "literal" is also registered.

at line 351
public leftDelimiter()

at line 359
public rightDelimiter()

at line 367
public setLeftDelimiter($delim)

Parameters

$delim

at line 375
public setRightDelimiter($delim)

Parameters

$delim

at line 384
public display($template = false, $extraParameters = false)

Parameters

$template
$extraParameters

at line 428
public createLocalVariablesList()

at line 437
public hasLocalVariable($varName, $rootNamespace)

Parameters

$varName
$rootNamespace

at line 446
public setLocalVariable($varName, $varValue, $rootNamespace)

Parameters

$varName
$varValue
$rootNamespace

at line 455
public unsetLocalVariable($varName, $rootNamespace)

Parameters

$varName
$rootNamespace

at line 467
public unsetLocalVariables()

at line 479
public destroyLocalVariablesList()

at line 493
public fetch($template = false, $extraParameters = false, $returnResourceData = false)

Parameters

$template
$extraParameters
$returnResourceData

at line 567
public process($root, $text, $rootNamespace, $currentNamespace)

Parameters

$root
$text
$rootNamespace
$currentNamespace

at line 582
public processNode($node, $textElements, $rootNamespace, $currentNamespace)

Parameters

$node
$textElements
$rootNamespace
$currentNamespace

at line 625
public processVariable($textElements, $variableData, $variablePlacement, $rootNamespace, $currentNamespace)

Parameters

$textElements
$variableData
$variablePlacement
$rootNamespace
$currentNamespace

at line 631
public processFunction($functionName, $textElements, $functionChildren, $functionParameters, $functionPlacement, $rootNamespace, $currentNamespace)

Parameters

$functionName
$textElements
$functionChildren
$functionParameters
$functionPlacement
$rootNamespace
$currentNamespace

at line 658
public fetchFunctionObject($functionName)

Parameters

$functionName

at line 674
public load($uri, $extraParameters = false, $returnResourceData = false)

Parameters

$uri
$extraParameters
$returnResourceData

at line 687
public parse($sourceText, $rootElement, $rootNamespace, $resourceData)

Parameters

$sourceText
$rootElement
$rootNamespace
$resourceData

at line 693
public loadURIData($resourceObject, $uri, $resourceName, $template, $extraParameters, $displayErrors = true)

Parameters

$resourceObject
$uri
$resourceName
$template
$extraParameters
$displayErrors

at line 721
public resourceData($resourceObject, $uri, $resourceName, $templateName)

Parameters

$resourceObject
$uri
$resourceName
$templateName

at line 740
public loadURIRoot($uri, $displayErrors = true, $extraParameters)

Parameters

$uri
$displayErrors
$extraParameters

at line 797
public processURI($uri, $displayErrors = true, $extraParameters, $textElements, $rootNamespace, $currentNamespace)

Parameters

$uri
$displayErrors
$extraParameters
$textElements
$rootNamespace
$currentNamespace

at line 853
public canCompileTemplate($resourceData, $extraParameters)

Parameters

$resourceData
$extraParameters

at line 867
public validateTemplateFile($file, $returnResourceData = false)

Parameters

$file
$returnResourceData

at line 916
public compileTemplateFile($file, $returnResourceData = false)

Parameters

$file
$returnResourceData

at line 962
public compileTemplate($resourceData, $extraParameters)

Parameters

$resourceData
$extraParameters

at line 974
public executeCompiledTemplate($resourceData, $textElements, $rootNamespace, $currentNamespace, $extraParameters)

Parameters

$resourceData
$textElements
$rootNamespace
$currentNamespace
$extraParameters

at line 997
public resourceFor($uri, $res, $template)

Parameters

$uri
$res
$template

at line 1022
public resourceHandler($resourceName)

Parameters

$resourceName

at line 1032
public hasChildren($function, $functionName)

Parameters

$function
$functionName

at line 1044
public emptyVariable()

at line 1052
public mergeNamespace($rootNamespace, $additionalNamespace)

Parameters

$rootNamespace
$additionalNamespace

at line 1065
public elementValue($dataElements, $rootNamespace, $currentNamespace, $placement = false, $checkExistance = false, $checkForProxy = false)

Parameters

$dataElements
$rootNamespace
$currentNamespace
$placement
$checkExistance
$checkForProxy

at line 1270
public expandAttributes($attributeList, $chooseText, $maxThreshold, $minThreshold = 1)

Parameters

$attributeList
$chooseText
$maxThreshold
$minThreshold

at line 1302
public processOperator($operatorName, $operatorParameters, $rootNamespace, $currentNamespace, $valueData, $placement = false, $checkExistance = false)

Parameters

$operatorName
$operatorParameters
$rootNamespace
$currentNamespace
$valueData
$placement
$checkExistance

at line 1366
public attributeValue($data, $nspace)

Parameters

$data
$nspace

at line 1393
public variableText($var, $namespace = '', $attrs = array())

Parameters

$var
$namespace
$attrs

at line 1407
public operatorParameterList($name)

Parameters

$name

at line 1440
public doOperator($element, $namespace, $current_nspace, $value, $operatorName, $operatorParameters, $named_params)

Parameters

$element
$namespace
$current_nspace
$value
$operatorName
$operatorParameters
$named_params

at line 1458
public doFunction($name, $func_obj, $nspace, $current_nspace)

Parameters

$name
$func_obj
$nspace
$current_nspace

at line 1486
public setVariable(string $var, string $val, string $namespace = '', bool $scopeSafe = false)

Sets the template variable $var to the value $val.

Parameters

string $var
string $val
string $namespace (optional)
bool $scopeSafe If true, will assure that $var is not overridden for $namespace. False by default

at line 1509
public unsetVariable(string $var, string $namespace = '')

Unsets the template variable $var.

Parameters

string $var
string $namespace (optional)

at line 1548
public bool hasVariable(string $var, string $namespace = '', array $attrs = null)

Returns true if the variable $var is set in namespace $namespace, if $attrs is supplied all attributes must exist for the function to return true.

Parameters

string $var
string $namespace (optional)
array $attrs (optional) Deprecated as of 4.4.

Return Value

bool

at line 1593
public string|array variable(string $var, string $namespace = '', array $attrs = null)

Returns the content of the variable $var using namespace $namespace, if $attrs is supplied the result of the attributes is returned.

Parameters

string $var
string $namespace (optional)
array $attrs (optional) Deprecated as of 4.4

Return Value

string|array

at line 1647
public variableAttribute($var, $attrs)

Parameters

$var
$attrs

at line 1686
public appendElement($text, $item, $nspace, $name)

Parameters

$text
$item
$nspace
$name

at line 1692
public appendElementText($textElements, $item, $nspace, $name)

Parameters

$textElements
$item
$nspace
$name

at line 1738
public appendDebugNodes($root, $resourceData)

Parameters

$root
$resourceData

at line 1775
public registerFunctions($functionObject)

Parameters

$functionObject

at line 1780
public registerAutoloadFunctions($functionDefinition)

Parameters

$functionDefinition

at line 1815
public loadAndRegisterFunctions($functionDefinition)

Parameters

$functionDefinition

at line 1848
public registerFunctionsInternal($functionObject, $debug = false)

Parameters

$functionObject
$debug

at line 1876
public registerFunction($func_name, $func_obj)

Parameters

$func_name
$func_obj

at line 1893
public registerLiteral($func_name)

Parameters

$func_name

at line 1901
public unregisterLiteral($func_name)

Parameters

$func_name

at line 1906
public registerAutoloadOperators($operatorDefinition)

Parameters

$operatorDefinition

at line 1934
public loadAndRegisterOperators($operatorDefinition)

Parameters

$operatorDefinition

at line 1970
public registerOperators($operatorObject)

Parameters

$operatorObject

at line 1975
public registerOperatorsInternal($operatorObject, $debug = false)

Parameters

$operatorObject
$debug

at line 1989
public registerOperator($op_name, $op_obj)

Parameters

$op_name
$op_obj

at line 1997
public unregisterOperator($op_name)

Parameters

$op_name

at line 2015
public registerFilter()

at line 2023
public registerResource($res)

Parameters

$res

at line 2034
public unregisterResource($res_name)

Parameters

$res_name

at line 2054
public setShowDetails($show)

Parameters

$show

at line 2062
public missingParameter($name, $param)

Parameters

$name
$param

at line 2070
public extraParameters($name, $count, $maxCount)

Parameters

$name
$count
$maxCount

at line 2078
public undefinedVariable($name, $var)

Parameters

$name
$var

at line 2086
public undefinedFunction($func_name)

Parameters

$func_name

at line 2095
public placementText($placement = false)

Parameters

$placement

at line 2123
public warning($name, $txt, $placement = false)

Parameters

$name
$txt
$placement

at line 2143
public error($name, $txt, $placement = false)

Parameters

$name
$txt
$placement

at line 2177
public operatorInputSupported($operatorName)

Parameters

$operatorName

at line 2184
public setIncludeText($uri, $text)

Parameters

$uri
$text

at line 2192
public setIncludeOutput($uri, $output)

Parameters

$uri
$output

at line 2200
public autoloadPathList()

at line 2208
public setAutoloadPathList($pathList)

Parameters

$pathList

at line 2217
public autoload()

at line 2257
public resetVariables()

at line 2266
public resetElements()

at line 2290
public reset()

at line 2306
public errorCount()

at line 2315
public hasErrors()

at line 2324
public errorLog()

at line 2333
public warningCount()

at line 2342
public hasWarnings()

at line 2351
public warningLog()

at line 2361
static public eZTemplate instance()

Returns a shared instance of the eZTemplate class.

Return Value

eZTemplate

at line 2380
static public eZTemplate factory()

Returns a shared instance of the eZTemplate class with default settings applied, like: - Autoload operators loaded - Debug mode set - eZTemplateDesignResource::instance registered

Return Value

eZTemplate

at line 2415
static public resetInstance()

Reset shared instance of the eZTemplate class and factory flag as used by {@link eZTemplate::instance()} and {@link eZTemplate::factory()}

at line 2426
public eZINI ini()

Returns the eZINI object instance for the template.ini file.

Return Value

eZINI

at line 2488
public isCachingAllowed()

at line 2500
public setIsCachingAllowed($allowed)

Parameters

$allowed

at line 2524
public setIsTemplatesUsageStatisticsEnabled($enabled)

Parameters

$enabled

at line 2538
public appendTemplateToStatisticsIfNeeded($templateName, $templateFileName)

Parameters

$templateName
$templateFileName

at line 2548
public appendTemplateToStatistics($templateName, $templateFileName)

Parameters

$templateName
$templateFileName

at line 2582
public appendTemplateFetch($actualTemplateName)

Parameters

$actualTemplateName

at line 2591
public resetErrorLog()

at line 2610
public templateFetchList()

at line 2621
public setCompileTest($val)

Parameters

$val

at line 2629
public testCompile()