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

__construct($tags) : void

Parameters

$tags

Generate the template and print/return it.

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

(do translations sequentially to save memory!!!)

Parameters

$template

string

Either template string or template file path

$return

bool

Return or print template

$note

bool

Echo "Generated by ... " Comment

Returns

stringComplete Template string

Iterate internal counter by one

next() : void

Replaces a named function with the translated variant

replacei18n(string $template, string $functionName) : void

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(string $which, string $needle, string $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

Sets the gettext domain to use for translations in a template

setDomain(string $sDomain) : void

Parameters

$sDomain

string

Sets the domain to use for template translations

Sets an encoding for the template's head block.

setEncoding(string $encoding) : void

Parameters

$encoding

string

Encoding to set

 Properties

 

$Dyn_needles : array
 

$Dyn_replacements : array
 

$dyn_cnt : int
 

$needles : array
 

$replacements : array
 

$tags : array
 

$_sDomain : string