ePages 7.26.0 - DE_EPAGES/Presentation/API/Object/TextProcessor.pm

Package DE_EPAGES::Presentation::API::Object::TextProcessor

Handles simple templates with subset of TLE functionality. Use method "registerHandler" to add more TLE handler. List of already registered TLE handler can be found new and DE_EPAGES::TLE::API::BaseProcessor::new
See DE_EPAGES::TLE::API::Processor::registerHandler

Base
DE_EPAGES::TLE::API::BaseProcessor
Example
...
# Example - hook subrutine which init some text based on ShopWizard input
my ($Servlet, $Shop) = @_;

my $TemplateWithTLEs = 'Preview :  #Shop.Address.Company - #Shop.Slogan';
# PageType only purpose is satisfy the dependencies of code included in $TemplateWithTLEs
my LoadPageTypeByAlias('SF-Shop');
my $ObjPageType = DE_EPAGES::Presentation::API::Object::ObjectPageType->load( $PageType, $Shop );

my $Processor = DE_EPAGES::Presentation::API::Object::TextProcessor->new();
my $FinishedTemplate = $Processor->processText($ObjPageType, $Shop, $TemplateWithTLEs, $Shop->tleHash, $Servlet->languageID );
...

Functions

new
processText

new

This method is used to create a new tle processor, this processor includes tle formatter and tle functions of these packages:

Syntax
$TLEProcessor = DE_EPAGES::Presentation::API::Object::TextProcessor->new;
Return
$TLEProcessor (blessed reference)
the tle processor

processText

Compile template and replace TLEs with localized values.

Syntax
$PlainTemplate = $Processor->processText( $ObjectPageType, $Object, $Template, $hTLEHash, $LanguageID )
Input
$ObjectPageType (DE_EPAGES::Presentation::API::Object::ObjectPageType)
PageType
$Object (object)
object linked to PageType
$Template (ref.string.)
template code with TLE commands, vars,...
$hTLEHash (ref.hash.)
input data for TLEs
$LanguageID (int)
id for language dependent lockups (optional)
Return
$PlainTemplate (ref.string.)
template with its TLSs replaced