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. | |
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.
| TemplumTemplate::TemplumTemplate | ( | $ | templum, | |
| $ | filename, | |||
| $ | contents, | |||
| $ | varsGlobal = array() | |||
| ) |
Create a new TemplumTemplate instance. You'd normally get an instance from a Templum class instance.
| $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.
| $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.
| $varsLocal | (array) An array of key/value pairs which represent the local variables for this template. |
| TemplumTemplate::errorHandler | ( | $ | nr, | |
| $ | string, | |||
| $ | file, | |||
| $ | line | |||
| ) |
The error handler that handles errors during the parsing of the template.
| $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. |
| TemplumTemplate::inc | ( | $ | template, | |
| $ | varsLocal = array() | |||
| ) |
Include another template.
| $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.
| $template | (string) The template to inherit from. |
1.5.1