class Template

Light template mechanism

author Jan Lengowski <Jan.Lengowski@4fb.de>
copyright four for business <http://www.4fb.de>
author Stefan Jelner (Optimizations)
version 1.0

 Methods

Constructor function

Template($tags) : void

Parameters

$tags

Generate the template and print/return it. (do translations sequentially to save memory!!!)

generate(\$template $template, \$return $return, \$note $note) : string

Parameters

$template

\$template

string/file Template

$return

\$return

bool Return or print template

$note

\$note

bool Echo "Generated by ... " Comment

Returns

stringcomplete Template string

replacei18n()

replacei18n(\$template $template, \$functionName $functionName) 

Replaces a named function with the translated variant

Parameters

$template

\$template

string Contents of the template to translate (it is reference to save memory!!!)

$functionName

\$functionName

string Name of the translation function (e.g. i18n)

Reset template data

reset() : void

Set Templates placeholders and values

set(\$which $which, \$needle $needle, \$replacement $replacement) : void

With this method you can replace the placeholders in the static templates with dynamic data.

Parameters

$which

\$which

String 's' for Static or else dynamic

$needle

\$needle

String Placeholder

$replacement

\$replacement

String Replacement String

setDomain

setDomain(\$sDomain $sDomain) : \none

Sets the gettext domain to use for translations in a template

Parameters

$sDomain

\$sDomain

string Sets the domain to use for template translations

Returns

\none

Sets an encoding for the template's head block.

setEncoding(\$encoding $encoding) 

Parameters

$encoding

\$encoding

string Encoding to set

 Properties

 

Dyn_Needles (dynamic)

$Dyn_needles : array

 

Dyn_Replacements (dynamic)

$Dyn_replacements : array

 

gettext domain (default: contenido)

$_sDomain : string

 

Database instance

$db : object

 

Dynamic counter

$dyn_cnt : int

 

Needles (static)

$needles : array

 

Replacements (static)

$replacements : array

 

Tags array (for dynamic blocks);

$tags : array