Templum Class Reference

Templum Templating Engine. More...

List of all members.

Public Member Functions

 Templum ($templatePath, $varsUniversal=array(), $locale=NULL)
 Create a new Templum instance.
 setVar ($varName, $varValue)
 Set a universal variable which will available in each template created with this Templum instance.
 setAutoEscape ($escape=True)
 Turn the auto escape on or off. If on, all content rendered using {{ and }} will automatically be escaped with htmlspecialchars().
 setLocale ($locale)
 Set the locale for templates.
 template ($path, $varsGlobal=array(), $autoEscape=NULL)
 Retrieve a template by from disk (caching it in memory for the duration of the Templum instance lifetime) or from cache.

Static Public Member Functions

static templateFromString ($contents, $autoEscape=Null)
 Create a TemplumTemplate from a string.


Detailed Description

Templum Templating Engine.

This is the main Templum class. It takes care of retrieval, caching and compiling of (translated) templates.


Member Function Documentation

Templum::Templum ( templatePath,
varsUniversal = array(),
locale = NULL 
)

Create a new Templum instance.

Parameters:
$templatePath (string) The full or relative path to the template directory.
$varsUniversal (array) An array of key/value pairs that will be exported to every template retrieved using this template engine instance.
$locale (string) The locale for the templates to retrieve. If a file with the suffix noted in $locale is available, it will be returned instead of the default .tpl file.
Exceptions:
TemplumError if the $templatePath can't be found or isn't a directory.

Templum::setVar ( varName,
varValue 
)

Set a universal variable which will available in each template created with this Templum instance.

Parameters:
$varName (string) The name of the variable. This will become available in the template as $VARNAME.
$varValue (mixed) The value of the variable.

Templum::setAutoEscape ( escape = True  ) 

Turn the auto escape on or off. If on, all content rendered using {{ and }} will automatically be escaped with htmlspecialchars().

Parameters:
$escape (boolean) True of False. If True, auto escaping is turned on (this is the default). If False, it is turned off for templates retrieved with this Templum engine.
Note:
Auto escaping can be overridden by passing the $autoEscape option to the template() and templateFromString() methods.

Templum::setLocale ( locale  ) 

Set the locale for templates.

Parameters:
$locale (string) The locale for the templates to retrieve. If a file with the suffix noted in $locale is available, it will be returned instead of the default .tpl file.

Templum::template ( path,
varsGlobal = array(),
autoEscape = NULL 
)

Retrieve a template by from disk (caching it in memory for the duration of the Templum instance lifetime) or from cache.

Parameters:
$path (string) TemplumTemplate path, without the .tpl extension, relative to the templatePath.
$varsGlobal (array) Array of key/value pairs that will be exported to the returned template and all templates included by that template.
$autoEscape (boolean) Whether to auto escape {{ and }} output with htmlspecialchars()
Exceptions:
TemplumError if the template couldn't be read.

static Templum::templateFromString ( contents,
autoEscape = Null 
) [static]

Create a TemplumTemplate from a string.

Create a TemplumTemplate instance using $contents as the template contents. This severely limited what you can do with the TemplumTemplate. There will be no including from the template, no translations, no caching, etc.

Parameters:
$contents (string) The template contents.
$autoEscape (boolean) Whether to auto escape {{ and }} output with htmlspecialchars()
Returns:
(TemplumTemplate) TemplumTemplate class instance.


The documentation for this class was generated from the following file:
Generated on Mon Oct 19 23:15:19 2009 for Templum by  doxygen 1.5.1