class Template

Light template mechanism

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

 Methods

Constructor function

Template($tags) : void

Parameters

$tags

Generate the template and print/return it.

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

(do translations sequentially to save memory!!!)

Parameters

$template

string/file Template

$return

bool Return or print template

$note

bool Echo "Generated by ... " Comment

Returns

stringcomplete Template string

Iterate internal counter by one

next() : void

replacei18n()

replacei18n($template, $functionName) 

Replaces a named function with the translated variant

Parameters

$template

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

$functionName

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

Reset template data

reset() : void

Set Templates placeholders and values

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

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

Parameters

$which

String 's' for Static or else dynamic

$needle

String Placeholder

$replacement

String Replacement String

setDomain

setDomain($sDomain) : \none

Sets the gettext domain to use for translations in a template

Parameters

$sDomain

string Sets the domain to use for template translations

Returns

\none

Sets an encoding for the template's head block.

setEncoding($encoding) 

Parameters

$encoding

string Encoding to set

 Properties

 

$Dyn_needles : array
 

$Dyn_replacements : array
 

$_sDomain : string
 

$db : object
 

$dyn_cnt : int
 

$needles : array
 

$replacements : array
 

$tags : array