ePages 6.11.0 - DE_EPAGES/Dictionary/API/Template.pm

Package DE_EPAGES::Dictionary::API::Template

This module provides file based template processing, including language dependend keywords. The package it self is also an INCLUDE Handler.

Example
use DE_EPAGES::Dictionary::API::Template qw (ProcessFileTemplate);
my $myContent = ProcessFileTemplate('myTemplate.tmpl', 'en', \%TemplateVars);
@EXPORT_OK
ProcessFileTemplate

Functions

INCLUDE
ProcessFileTemplate
TRANSLATE

INCLUDE

TLE-Include on file base, replaces also the localizer tags. If the debugging mode for this function is enabled, an html comment wraps result (includes file name and processing time).

Syntax
$result = $Handler->INCLUDE($Processor, $raParams);
#INCLUDE("FileName")
Example
#INCLUDE("myIncludeTemplate.tmpl")
Input
$FileName (filename of template)
string
$raParams (ref.array.string)
parameter of tle function call
Return
$result (string)
result string

ProcessFileTemplate

Localizes a template and replaces embedded placeholders (TLE variables). Returns the complete page content.

Syntax
$Content = ProcessFileTemplate($FileName, $LanguageCode, $hVars);
$Content = ProcessFileTemplate($FileName, $LanguageCode, $hVars, $TLEProcessor, $IncludeHandler);
Example
print ProcessFileTemplate('ProductDetails.html', 'en', \%Vars);
Input
$FileName (string)
template file name
$LanguageCode (string)
language code
$hVars (ref.(hash.array.)*string)
template vars (vars and loops)
$TLEProcessor (object)
(optional) template processor
$IncludeHandler (object)
(optional) include handler
Return
$Content (string)
replaced content

TRANSLATE

Translates a keyword during runtime of template, same result like {Key} in template.

Syntax
$result = $Handler->TRANSLATE($Processor, $raParams);
#TRANSLATE(#Key, #DoProcess)
Example
#LOCAL("MaxLength", 6)#FUNCTION("TRANSLATE", "ValueTooLongName")#ENDLOCAL
#LOCAL("MaxLength", 6)#FUNCTION("TRANSLATE", "ValueTooLongName", 0)#ENDLOCAL
Input
$Key (string)
translation key word
$DoProcess (boolean)
process result as template (default 1)
Return
$result (string)
result string