Class TTemplateManager
TTemplateManager class
TTemplateManager manages the loading and parsing of control templates. There are two ways of loading a template, either by the associated template control class name, or the template file name. The former is via calling getTemplateByClassName, which tries to locate the corresponding template file under the directory containing the class file. The name of the template file is the class name with the extension '.tpl'. To load a template from a template file path, call getTemplateByFileName. By default, TTemplateManager is registered with TPageService as the template manager module that can be accessed via TPageService::getTemplateManager().
Method Summary |
protected
string|null
|
Finds a localized template file.
|
ITemplate
|
Loads the template corresponding to the specified class name.
|
ITemplate
|
Loads the template from the specified file.
|
void
|
Initializes the module.
|
Methods Inherited From TComponent |
TComponent::addParsedObject(), TComponent::attachEventHandler(), TComponent::canGetProperty(), TComponent::canSetProperty(), TComponent::createdOnTemplate(), TComponent::detachEventHandler(), TComponent::evaluateExpression(), TComponent::evaluateStatements(), TComponent::getEventHandlers(), TComponent::getSubProperty(), TComponent::hasEvent(), TComponent::hasEventHandler(), TComponent::hasProperty(), TComponent::raiseEvent(), TComponent::setSubProperty(), TComponent::__get(), TComponent::__set()
|
Method Details |
getLocalizedTemplate
protected string|null getLocalizedTemplate |
(string $filename ) |
Finds a localized template file.
Input |
string | $filename | template file. |
Output |
string|null
| a localized template file if found, null otherwise. |
Exception |
|
getTemplateByClassName
public ITemplate getTemplateByClassName |
(mixed $className ) |
Loads the template corresponding to the specified class name.
Input |
mixed | $className | |
Output |
ITemplate
| template for the class name, null if template doesn't exist. |
Exception |
|
getTemplateByFileName
public ITemplate getTemplateByFileName |
(mixed $fileName ) |
Loads the template from the specified file.
Input |
mixed | $fileName | |
Output |
ITemplate
| template parsed from the specified file, null if the file doesn't exist. |
Exception |
|
init
Initializes the module.
This method is required by IModule and is invoked by application. It starts output buffer if it is enabled.
Input |
TXmlElement | $config | module configuration |
Output |
Exception |
|
Constant Details |
TEMPLATE_CACHE_PREFIX
Prefix of the cache variable name for storing parsed templates
Type:
string
Value:
'prado:template:'
|
TEMPLATE_FILE_EXT
Template file extension
Type:
string
Value:
'.tpl'
|
|