Packages:
default
System
System.Caching
System.Collections
System.Data
System.Data.ActiveRecord
System.Data.ActiveRecord.Relations
System.Data.ActiveRecord.Scaffold
System.Data.ActiveReecord.Scaffold.InputBuilder
System.Data.Commom.Sqlite
System.Data.Common
System.Data.Common.Mssql
System.Data.Common.Mysql
System.Data.Common.Oracle
System.Data.Common.Pgsql
System.Data.Common.Sqlite
System.Data.DataGateway
System.Data.SqlMap
System.Data.SqlMap.Configuration
System.Data.SqlMap.Statements
System.Exceptions
System.I18N
System.IO
System.Security
System.Util
System.Web
System.Web.Services
System.Web.UI
System.Web.UI.ActiveControls
System.Web.UI.WebControls
System.Web.UI.WebControls.assets
System.Xml


Classes:
Keyword

Class TTemplateManager

TComponent
   |
   --TApplicationComponent
      |
      --TModule
         |
         --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().

Since: 3.0
Author: Qiang Xue <qiang.xue@gmail.com>

Method Summary
protected  string|null
getLocalizedTemplate ( string $filename)
Finds a localized template file.
ITemplate
getTemplateByClassName ( mixed $className)
Loads the template corresponding to the specified class name.
ITemplate
getTemplateByFileName ( mixed $fileName)
Loads the template from the specified file.
void
init ( TXmlElement $config)
Initializes the module.
Methods Inherited From TModule
TModule::getID(), TModule::init(), TModule::setID()
Methods Inherited From TApplicationComponent
TApplicationComponent::getApplication(), TApplicationComponent::getRequest(), TApplicationComponent::getResponse(), TApplicationComponent::getService(), TApplicationComponent::getSession(), TApplicationComponent::getUser(), TApplicationComponent::publishAsset(), TApplicationComponent::publishFilePath()
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()

Constant Summary
string TEMPLATE_CACHE_PREFIX Prefix of the cache variable name for storing parsed templates
string TEMPLATE_FILE_EXT Template file extension

Method Details

getLocalizedTemplate

protected string|null getLocalizedTemplate (string $filename )

Finds a localized template file.

Input
string$filenametemplate 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

public void init (TXmlElement $config )

Initializes the module.

This method is required by IModule and is invoked by application. It starts output buffer if it is enabled.

Input
TXmlElement$configmodule 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'