Class TTemplateManager

Description

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
  • version: $Id: TTemplateManager.php 2297 2007-10-03 21:21:40Z xue $
  • author: Qiang Xue <qiang.xue@gmail.com>

Located in /Web/UI/TTemplateManager.php (line 39)

TComponent
   |
   --TApplicationComponent
      |
      --TModule
         |
         --TTemplateManager
Class Constant Summary
 TEMPLATE_CACHE_PREFIX = 'prado:template:'
Method Summary
string|null getLocalizedTemplate (string $filename)
ITemplate getTemplateByClassName (mixed $className)
ITemplate getTemplateByFileName (mixed $fileName)
void init (TXmlElement $config)
Methods
getLocalizedTemplate (line 122)

Finds a localized template file.

  • return: a localized template file if found, null otherwise.
  • access: protected
string|null getLocalizedTemplate (string $filename)
  • string $filename: template file.
getTemplateByClassName (line 65)

Loads the template corresponding to the specified class name.

  • return: template for the class name, null if template doesn't exist.
  • access: public
ITemplate getTemplateByClassName (mixed $className)
getTemplateByFileName (line 76)

Loads the template from the specified file.

  • return: template parsed from the specified file, null if the file doesn't exist.
  • access: public
ITemplate getTemplateByFileName (mixed $fileName)
init (line 56)

Initializes the module.

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

  • access: public
void init (TXmlElement $config)

Redefinition of:
TModule::init()
Initializes the module.

Inherited Methods

Inherited From TModule

TModule::getID()
TModule::init()
TModule::setID()

Inherited From TApplicationComponent

TApplicationComponent::getApplication()
TApplicationComponent::getRequest()
TApplicationComponent::getResponse()
TApplicationComponent::getService()
TApplicationComponent::getSession()
TApplicationComponent::getUser()
TApplicationComponent::publishAsset()
TApplicationComponent::publishFilePath()

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()
Class Constants
TEMPLATE_CACHE_PREFIX = 'prado:template:' (line 48)

Prefix of the cache variable name for storing parsed templates

TEMPLATE_FILE_EXT = '.tpl' (line 44)

Template file extension

Documentation generated on Mon, 21 Apr 2008 11:36:32 -0400 by phpDocumentor 1.3.0RC4