jTpl
in package
template engine
Tags
Table of Contents
- $_meta : array<string|int, mixed>
- internal use It have a public access only for plugins. So you must not use directly this property except from tpl plugins.
- $_privateVars : array<string|int, mixed>
- temporary template variables for plugins.
- $_templateName : string
- contains the name of the template file It have a public access only for plugins. So you musn't use directly this property except from tpl plugins.
- $_vars : array<string|int, mixed>
- all assigned template variables.
- $processedMeta : mixed
- $recursiveTpl : mixed
- $userFunctions : mixed
- $userModifiers : mixed
- __construct() : mixed
- append() : mixed
- concat a value in with a value of an existing template variable
- appendZone() : mixed
- append a zone content to a template variable
- assign() : mixed
- assign a value in a template variable
- assignByRef() : mixed
- assign a value by reference in a template variable
- assignIfNone() : mixed
- assign a value in a template variable, only if the template variable doesn't exist
- assignZone() : mixed
- assign a zone content to a template variable
- assignZoneIfNone() : mixed
- assign a zone content to a template variable only if this variable doesn't exist
- display() : mixed
- display the generated content from the given template
- fetch() : string
- return the generated content from the given template
- fetchFromString() : string
- Return the generated content from the given string template (virtual)
- get() : mixed
- return the value of a template variable
- getEncoding() : string
- return the current encoding
- getTemplateVars() : array<string|int, mixed>
- Return all template variables
- isAssigned() : bool
- says if a template variable exists
- meta() : array<string|int, mixed>
- process all meta instruction of a template
- registerFunction() : mixed
- register a user function. The function should accept a jTpl object as first parameter.
- registerModifier() : mixed
- register a user modifier. The function should accept at least a string as first parameter, and should return this string which can be modified.
- getTemplate() : string
- include the compiled template file and call one of the generated function
Properties
$_meta
internal use It have a public access only for plugins. So you must not use directly this property except from tpl plugins.
public
array<string|int, mixed>
$_meta
= array()
$_privateVars
temporary template variables for plugins.
public
array<string|int, mixed>
$_privateVars
= array()
It have a public access only for plugins. So you musn't use directly this property except from tpl plugins.
$_templateName
contains the name of the template file It have a public access only for plugins. So you musn't use directly this property except from tpl plugins.
public
string
$_templateName
Tags
$_vars
all assigned template variables.
public
array<string|int, mixed>
$_vars
= array()
It have a public access only for plugins. So you musn't use directly this property except from tpl plugins. See methods of jTpl to manage template variables
$processedMeta
protected
mixed
$processedMeta
= array()
$recursiveTpl
protected
mixed
$recursiveTpl
= array()
$userFunctions
protected
mixed
$userFunctions
= array()
$userModifiers
protected
mixed
$userModifiers
= array()
Methods
__construct()
public
__construct() : mixed
Return values
mixed —append()
concat a value in with a value of an existing template variable
public
append(string|array<string|int, mixed> $name[, mixed $value = null ]) : mixed
Parameters
- $name : string|array<string|int, mixed>
-
the variable name, or an associative array 'name'=>'value'
- $value : mixed = null
-
the value (or null if $name is an array)
Return values
mixed —appendZone()
append a zone content to a template variable
public
appendZone(string $name, string $zoneName[, array<string|int, mixed> $params = array() ]) : mixed
Parameters
- $name : string
-
the variable name
- $zoneName : string
-
a zone selector
- $params : array<string|int, mixed> = array()
-
parameters for the zone
Tags
Return values
mixed —assign()
assign a value in a template variable
public
assign(string|array<string|int, mixed> $name[, mixed $value = null ]) : mixed
Parameters
- $name : string|array<string|int, mixed>
-
the variable name, or an associative array 'name'=>'value'
- $value : mixed = null
-
the value (or null if $name is an array)
Return values
mixed —assignByRef()
assign a value by reference in a template variable
public
assignByRef(string $name, mixed &$value) : mixed
Parameters
- $name : string
-
the variable name
- $value : mixed
-
the value
Tags
Return values
mixed —assignIfNone()
assign a value in a template variable, only if the template variable doesn't exist
public
assignIfNone(string|array<string|int, mixed> $name[, mixed $value = null ]) : mixed
Parameters
- $name : string|array<string|int, mixed>
-
the variable name, or an associative array 'name'=>'value'
- $value : mixed = null
-
the value (or null if $name is an array)
Return values
mixed —assignZone()
assign a zone content to a template variable
public
assignZone(string $name, string $zoneName[, array<string|int, mixed> $params = array() ]) : mixed
Parameters
- $name : string
-
the variable name
- $zoneName : string
-
a zone selector
- $params : array<string|int, mixed> = array()
-
parameters for the zone
Tags
Return values
mixed —assignZoneIfNone()
assign a zone content to a template variable only if this variable doesn't exist
public
assignZoneIfNone(string $name, string $zoneName[, array<string|int, mixed> $params = array() ]) : mixed
Parameters
- $name : string
-
the variable name
- $zoneName : string
-
a zone selector
- $params : array<string|int, mixed> = array()
-
parameters for the zone
Tags
Return values
mixed —display()
display the generated content from the given template
public
display(string $tpl[, string $outputtype = '' ][, bool $trusted = true ]) : mixed
Parameters
- $tpl : string
-
template selector
- $outputtype : string = ''
-
the type of output (html, text etc..)
- $trusted : bool = true
-
says if the template file is trusted or not
Return values
mixed —fetch()
return the generated content from the given template
public
fetch(string $tpl[, string $outputtype = '' ][, bool $trusted = true ][, bool $callMeta = true ]) : string
Parameters
- $tpl : string
-
template selector
- $outputtype : string = ''
-
the type of output (html, text etc..)
- $trusted : bool = true
-
says if the template file is trusted or not
- $callMeta : bool = true
-
false if meta should not be called
Tags
Return values
string —the generated content
fetchFromString()
Return the generated content from the given string template (virtual)
public
fetchFromString(string $tpl[, string $outputtype = '' ][, bool $trusted = true ][, bool $callMeta = true ]) : string
Parameters
- $tpl : string
-
template content
- $outputtype : string = ''
-
the type of output (html, text etc..)
- $trusted : bool = true
-
says if the template file is trusted or not
- $callMeta : bool = true
-
false if meta should not be called
Tags
Return values
string —the generated content
get()
return the value of a template variable
public
get(string $name) : mixed
Parameters
- $name : string
-
the variable template name
Return values
mixed —the value (or null if it isn't exist)
getEncoding()
return the current encoding
public
static getEncoding() : string
Tags
Return values
string —the charset string
getTemplateVars()
Return all template variables
public
getTemplateVars() : array<string|int, mixed>
Return values
array<string|int, mixed> —isAssigned()
says if a template variable exists
public
isAssigned(string $name) : bool
Parameters
- $name : string
-
the variable template name
Return values
bool —true if the variable exists
meta()
process all meta instruction of a template
public
meta(string $tpl[, string $outputtype = '' ][, bool $trusted = true ]) : array<string|int, mixed>
Parameters
- $tpl : string
-
template selector
- $outputtype : string = ''
-
the type of output (html, text etc..)
- $trusted : bool = true
-
says if the template file is trusted or not
Return values
array<string|int, mixed> —registerFunction()
register a user function. The function should accept a jTpl object as first parameter.
public
registerFunction(string $name, string $functionName) : mixed
Parameters
- $name : string
-
the name of the modifier in a template
- $functionName : string
-
the corresponding PHP function
Tags
Return values
mixed —registerModifier()
register a user modifier. The function should accept at least a string as first parameter, and should return this string which can be modified.
public
registerModifier(string $name, string $functionName) : mixed
Parameters
- $name : string
-
the name of the modifier in a template
- $functionName : string
-
the corresponding PHP function
Tags
Return values
mixed —getTemplate()
include the compiled template file and call one of the generated function
protected
getTemplate(string|jSelectorTpl $tpl[, string $outputtype = '' ][, bool $trusted = true ]) : string
Parameters
- $tpl : string|jSelectorTpl
-
template selector
- $outputtype : string = ''
-
the type of output (html, text etc..)
- $trusted : bool = true
-
says if the template file is trusted or not
Tags
Return values
string —the suffix name of the function to call