Package DE_EPAGES::Presentation::API::Template
This module provides page type based template processing, including language dependend keywords.
Base |
DE_EPAGES::Dictionary::API::Template |
Example |
use DE_EPAGES::Presentation::API::Template qw (ProcessPage); use DE_EPAGES::Presentation::API::PageType qw (LoadPageTypeByAlias); use DE_EPAGES::Object::API::Factory qw (LoadObjectByPath); my $Object = LoadObjectByPath('/Shops/DemoShop'); my $PageType = LoadPageTypeByAlias('Details'); my $myContent = ProcessPage($Object, $PageType, 'en', {}); |
@EXPORT_OK |
Functions
GetAllInfoTemplateType
Returns the attributes of all objects of class "TemplateType" as hash.
Syntax |
$ahInfo = GetAllInfoTemplateType(); |
Example |
@$ahInfo = @{GetAllInfoTemplateType()}; |
Input |
|
Return |
|
GetTLEProcessor
Returns an instance of a TLEProcessor. If possible the object will be retrieved from cache otherwise instantiated.
Syntax |
$TLEProcessor = GetTLEProcessor(); $TLEProcessor = GetTLEProcessor($CacheName,$PackageName); |
Example |
$TLEProcessor = GetTLEProcessor('SitePageProcessor',__PACKAGE__); |
Input |
|
Return |
|
INCLUDE
Returns processed content of the include template. If the debugging mode for this function is enabled, an html comment wraps result (includes file name and processing time). WithDebugInfo strings can be: "NoDebug", "JsDebug", "CssDebug" or "HtmlDebug".
Syntax |
#INCLUDE(#Name, #NoDebug) |
Example |
#INCLUDE("Header") ... #INCLUDE("Footer") #INCLUDE("StyleSheet", "NoDebug") |
Input |
|
Return |
|
IsEmpty
Returns true if the value is empty respectively has only debug comments
Syntax |
#IsEmpty(#Value) |
Example |
#IsEmpty(#INCLUDE("Footer")) |
ProcessPage
Localizes a template by replacing localization tags, then replaces embedded placeholders (TLE variables). Returns the complete page content. Note: the parameter $LanguageCode specifies the language for localization tags in the template , i.e. static content. The language for dynamic content, such as attributes of type LocalizedString is specified by the global variable $DE_EPAGES::Object::API::Language::LANGUAGEID.
Syntax |
$Content = ProcessPage($Object, $ObjectPageType, $LanguageCode, $hVars, $TLEProcessor, $IncludeHandler, $TemplateName); |
Example |
my $PageType = LoadPageTypeByAlias( 'SF-Category' ); my $ObjectPageType = DE_EPAGES::Presentation::API::Object::ObjectPageType->load( $PageType, $Category ); { local $DE_EPAGES::Object::API::Language::LANGUAGEID = GetPKeyLanguageByCode('en'); print ProcessPage( $Category, $ObjectPageType, 'en', $Category->tleHash ); } |
Input |
|
Return |
|
dictionaryFiles
Returns a list of dictionary files for a language-neutral template file.
Syntax |
$aFiles = $Handler->dictionaryFiles( $FileName, $LanguageIdentifier ); |
Example |
$aFiles = $Handler->dictionaryFiles( 'Template.tmpl', 'de' ); |
Input |
|
Return |
|
templateFileName
Returns the path to a template file. If the file does not exist in the store directory ($ENV{EPAGES_STORES}/$StoreName/Templates/$Company/$Cartridge/$FileName), then the default template is taken from the cartridge directory ($ENV{EPAGES_CARTRIDGES}/$Company/$Cartridge/Templates/$FileName).
Syntax |
$FileName = $Handler->templateFileName( $hTemplate ); |
Example |
$hTemplate = $PageType->template( 'Page', $Object ); $FileName = $Handler->templateFileName( $hTemplate ); |
Input |
|
Return |
|