jTpl

template engine

package

jelix

subpackage

jtpl

Methods

__construct

__construct() 

concat a value in with a value of an existing template variable

append(string|array $name, mixed $value = null) 

Arguments

$name

string|array

the variable name, or an associative array 'name'=>'value'

$value

mixed

the value (or null if $name is an array)

append a zone content to a template variable

appendZone(string $name, string $zoneName, array $params = array()) 
see \jZone
since 1.0

Arguments

$name

string

the variable name

$zoneName

string

a zone selector

$params

array

parameters for the zone

assign a value in a template variable

assign(string|array $name, mixed $value = null) 

Arguments

$name

string|array

the variable name, or an associative array 'name'=>'value'

$value

mixed

the value (or null if $name is an array)

assign a value by reference in a template variable

assignByRef(string $name, mixed &$value) 
since

jelix 1.1

Arguments

$name

string

the variable name

$value

mixed

the value

assign a value in a template variable, only if the template variable doesn't exist

assignIfNone(string|array $name, mixed $value = null) 

Arguments

$name

string|array

the variable name, or an associative array 'name'=>'value'

$value

mixed

the value (or null if $name is an array)

assign a zone content to a template variable

assignZone(string $name, string $zoneName, array $params = array()) 
see \jZone

Arguments

$name

string

the variable name

$zoneName

string

a zone selector

$params

array

parameters for the zone

assign a zone content to a template variable only if this variable doesn't exist

assignZoneIfNone(string $name, string $zoneName, array $params = array()) 
see \jZone

Arguments

$name

string

the variable name

$zoneName

string

a zone selector

$params

array

parameters for the zone

display the generated content from the given template

display(string $tpl, string $outputtype = '', boolean $trusted = true) 

Arguments

$tpl

string

template selector

$outputtype

string

the type of output (html, text etc..)

$trusted

boolean

says if the template file is trusted or not

return the generated content from the given template

fetch(string $tpl, string $outputtype = '', boolean $trusted = true, boolean $callMeta = true) : string
Throws
\Exception

Arguments

$tpl

string

template selector

$outputtype

string

the type of output (html, text etc..)

$trusted

boolean

says if the template file is trusted or not

$callMeta

boolean

false if meta should not be called

Response

string

the generated content

Return the generated content from the given string template (virtual)

fetchFromString(string $tpl, string $outputtype = '', boolean $trusted = true, boolean $callMeta = true) : string
Throws
\Exception

Arguments

$tpl

string

template content

$outputtype

string

the type of output (html, text etc..)

$trusted

boolean

says if the template file is trusted or not

$callMeta

boolean

false if meta should not be called

Response

string

the generated content

return the value of a template variable

get(string $name) : mixed

Arguments

$name

string

the variable template name

Response

mixed

the value (or null if it isn't exist)

return the current encoding

getEncoding() : string
static
since 1.0b2

Response

string

the charset string

include the compiled template file and call one of the generated function

getTemplate(string|\jSelectorTpl $tpl, string $outputtype = '', boolean $trusted = true) : string
Throws
\Exception

Arguments

$tpl

string|\jSelectorTpl

template selector

$outputtype

string

the type of output (html, text etc..)

$trusted

boolean

says if the template file is trusted or not

Response

string

the suffix name of the function to call

Return all template variables

getTemplateVars() : array

Response

array

says if a template variable exists

isAssigned(string $name) : boolean

Arguments

$name

string

the variable template name

Response

boolean

true if the variable exists

process all meta instruction of a template

meta(string $tpl, string $outputtype = '', boolean $trusted = true) : array

Arguments

$tpl

string

template selector

$outputtype

string

the type of output (html, text etc..)

$trusted

boolean

says if the template file is trusted or not

Response

array

register a user function. The function should accept a jTpl object as first parameter.

registerFunction(string $name, string $functionName) 
since

jelix 1.1

Arguments

$name

string

the name of the modifier in a template

$functionName

string

the corresponding PHP function

register a user modifier. The function should accept at least a string as first parameter, and should return this string which can be modified.

registerModifier(string $name, string $functionName) 
since

jelix 1.1

Arguments

$name

string

the name of the modifier in a template

$functionName

string

the corresponding PHP function

Properties

all assigned template variables.

_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

var

Type(s)

array

temporary template variables for plugins.

_privateVars : array

It have a public access only for plugins. So you musn't use directly this property except from tpl plugins.

var

Type(s)

array

internal use It have a public access only for plugins. So you must not use directly this property except from tpl plugins.

_meta : array
var

Type(s)

array

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.

_templateName : string
var
since

Type(s)

string

recursiveTpl

recursiveTpl : 

Type(s)

processedMeta

processedMeta : 

Type(s)

userModifiers

userModifiers : 

Type(s)

userFunctions

userFunctions : 

Type(s)