TemplumTemplate Class Reference

Template class. More...

List of all members.

Public Member Functions

 TemplumTemplate ($templum, $filename, $contents, $varsGlobal=array())
 Create a new TemplumTemplate instance. You'd normally get an instance from a Templum class instance.
 setVar ($varName, $varValue)
 Add an global variable. The global variable will be available to this templates and all the templates it includes.
 render ($varsLocal=array())
 Render the contents of the template and return it as a string.
 errorHandler ($nr, $string, $file, $line)
 The error handler that handles errors during the parsing of the template.
 inc ($template, $varsLocal=array())
 Include another template.
 inherit ($template)
 Inherit from a parent template.


Detailed Description

Template class.

This is the TemplumTemplate class. It represents a template and handles the actual rendering of the template, as well as catching errors during rendering. It also contains helper methods which can be used in templates.


Member Function Documentation

TemplumTemplate::TemplumTemplate ( templum,
filename,
contents,
varsGlobal = array() 
)

Create a new TemplumTemplate instance. You'd normally get an instance from a Templum class instance.

Parameters:
$templum (Templum instance) The Templum class instance that generated this TemplumTemplate instance.
$filename (string) The filename of this template.
$contents (string) The compiled contents of this template.
$varsGlobal (array) An array of key/value pairs which represent the global variables for this template and the templates it includes.

TemplumTemplate::setVar ( varName,
varValue 
)

Add an global variable. The global variable will be available to this templates and all the templates it includes.

Parameters:
$varName (string) The name of the variable.
$varValue (mixed) The value of the variable.

TemplumTemplate::render ( varsLocal = array()  ) 

Render the contents of the template and return it as a string.

Parameters:
$varsLocal (array) An array of key/value pairs which represent the local variables for this template.
Returns:
(string) The rendered contents of the template.

TemplumTemplate::errorHandler ( nr,
string,
file,
line 
)

The error handler that handles errors during the parsing of the template.

Parameters:
$nr (int) Error code
$string (string) Error message
$file (string) Filename of the file in which the erorr occurred.
$line (int) Linenumber of the line on which the error occurred.
Note:
Do not call this yourself. It is used internally by Templum but must be public.

TemplumTemplate::inc ( template,
varsLocal = array() 
)

Include another template.

Parameters:
$template (string) The template to include.
$varsLocal (array) An array of key/value pairs which represent the local variables for this template.

TemplumTemplate::inherit ( template  ) 

Inherit from a parent template.

Parameters:
$template (string) The template to inherit from.


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