contenido\classes\class.template.php

Show: PublicProtectedPrivateinherited
Table of Contents
Project: Contenido Content Management System

Description: Contenido Template Engine

Requirements:

Author
Jan Lengowski  
Con_php_req
5.0  
Copyright
four for business AG  
License
http://www.contenido.org/license/LIZENZ.txt  
Link
http://www.4fb.de  
Link
http://www.contenido.org  
Package
Contenido Backend classes  
Since
file available since contenido release <= 4.6 {@internal created unknown modified 2008-06-30, Frederic Schneider, add security fix modified 2008-09-03 Timo Trautmann, DB Object is only created if necessary modified 2010-02-01 Ingo van Peeren, Removed deprecated functions and arrays because they are not used anymore $Id: class.template.php 1206 2010-09-08 20:29:12Z xmurrix $: }}  
Version
1.2.3  

\Template

Package: Default
class Template

Light template mechanism

Author
Jan Lengowski  
Author
Stefan Jelner (Optimizations)  
Copyright
four for business  
Version
1.0  

Properties

>VPropertypublicarray $Dyn_needles = array()
Dyn_Needles (dynamic)
Default valuearray()Details
Type
array
>VPropertypublicarray $Dyn_replacements = array()
Dyn_Replacements (dynamic)
Default valuearray()Details
Type
array
>VPropertypublicstring $_sDomain = "contenido"
gettext domain (default: contenido)
Default value"contenido"Details
Type
string
>VPropertypublicobject $db
Database instance
Details
Type
object
>VPropertypublicint $dyn_cnt = 0
Dynamic counter
Default value0Details
Type
int
>VPropertypublicarray $needles = array()
Needles (static)
Default valuearray()Details
Type
array
>VPropertypublicarray $replacements = array()
Replacements (static)
Default valuearray()Details
Type
array
>VPropertypublicarray $tags = array('static' => '{%s}', 'start' => '<!-- BEGIN:BLOCK -->', 'end' => '<!-- END:BLOCK -->')
Tags array (for dynamic blocks);
Default valuearray('static' => '{%s}', 'start' => '<!-- BEGIN:BLOCK -->', 'end' => '<!-- END:BLOCK -->')Details
Type
array

Methods

methodpublicTemplate( $tags = false) : void

Constructor function

Parameters
NameTypeDescription
$tags
methodpublicgenerate( $template,  $return = 0,  $note = 0) : string

Generate the template and print/return it.

(do translations sequentially to save memory!!!)

Parameters
NameTypeDescription
$template

string/file Template

$return

bool Return or print template

$note

bool Echo "Generated by ... " Comment

Returns
TypeDescription
stringcomplete Template string
methodpublicnext() : void

Iterate internal counter by one

methodpublicreplacei18n( $template,  $functionName) : void

replacei18n()

Replaces a named function with the translated variant

Parameters
NameTypeDescription
$template

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

$functionName

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

methodpublicreset() : void

Reset template data

methodpublicset( $which = 's',  $needle,  $replacement) : void

Set Templates placeholders and values

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

Parameters
NameTypeDescription
$which

String 's' for Static or else dynamic

$needle

String Placeholder

$replacement

String Replacement String

methodpublicsetDomain( $sDomain) : \none

setDomain

Sets the gettext domain to use for translations in a template

Parameters
NameTypeDescription
$sDomain

string Sets the domain to use for template translations

Returns
TypeDescription
\none
methodpublicsetEncoding( $encoding) : void

Sets an encoding for the template's head block.

Parameters
NameTypeDescription
$encoding

string Encoding to set

Documentation was generated by phpDocumentor 2.0.0a12.