Template: ezcTemplateConfiguration
[ ]
[ EBNF ] [ Functions ]
[ ]
[ ]
[ ]
[ ]
Class: ezcTemplateConfiguration
|
Contains the common configuration options for template managers. [
source]
Whenever a template source or compiled code is accessed it will use the $templatePath and $compilePath respectively as the base path. The full path is generated by using the value of theses variables and then appending a slash (/) and the subpath, this means it is possible to have the templates in the root of the filesystem by setting an empty string or a string starting with a slash. The next example demonstrates how the templatePath and compilePath can be set:
1. // accessing templates in /usr/share and compile them in /var/cache
2. $conf->templatePath = "/usr/share/eztemplate";
3. $conf->compilePath = "/var/cache/eztemplate";
Accessing templates from the applications directory is done with a single dot (.), these are also the default values.
1. // uses current directory for accessing templates and compiling them
2. $conf->templatePath = ".";
3. $conf->compilePath = ".";
The $context property is by default assigned to an ezcTemplateXhtmlContext object.
Properties
Method Summary
|
public ezcTemplateConfiguration |
__construct(
[$templatePath = "."], [$compilePath = "."], [$context = null] )
Initialises the configuration with default template, compiled path, and context. |
|
public void |
addExtension(
$customClass )
Adds custom tags or function to the customBlock or customFunction property and indirectly add the custom extension to the template language. |
|
public static ezcTemplateConfiguration |
getInstance(
[$name = "default"] )
Returns the unique configuration instance named $name. |
Methods
__construct
ezcTemplateConfiguration __construct(
[string
$templatePath = "."], [string
$compilePath = "."], [
ezcTemplateOutputContext
$context = null] )
Initialises the configuration with default template, compiled path, and context.
All requested templates are search from the defined $templatePath. Use an empty string to fetch templates from the root of the filesystem.
All compiled templates are placed in subfolders under the compiled templates. Use an empty string to compile templates at the root of the filesystem.
Parameters
| Name |
Type |
Description |
$templatePath |
string |
Path where the source templates are stored. |
$compilePath |
string |
Path where the compiled templates should be stored. |
$context |
ezcTemplateOutputContext |
Context to use. Default is the ezcTemplateXhtmlContext. |
addExtension
void addExtension(
string
$customClass )
Adds custom tags or function to the customBlock or customFunction property and indirectly add the custom extension to the template language.
The parameter $customBlockClass expects a class that implements either the interface ezcTemplateCustomBlock, ezcTemplateCustomFunction, or both.
New custom blocks are added to the ezcTemplateConfiguration::customBlocks property while custom functions are added to the ezcTemplateConfiguration::customFunctions property.
Parameters
| Name |
Type |
Description |
$customClass |
string |
|
Throws
| Class | Description |
ezcTemplateCustomBlockException |
if the $customClass parameter is not a string. |
getInstance
Returns the unique configuration instance named $name.
Note: You only need to specify the name if you need multiple configuration objects.
Parameters
| Name |
Type |
Description |
$name |
string |
Name of the configuration to use. |
Last updated: Thu, 31 Jan 2008