Package DE_EPAGES::TLE::API::Template
This package provides a basic file based template processing.
The most used template processing is based on page types, see DE_EPAGES::Presentation::API::Template.
A filebased template processing including dictionary files, see DE_EPAGES::Dictionary::API::Template.
A content (perl-string) template processing exists via DE_EPAGES::TLE::API::TLE.
Example |
use DE_EPAGES::TLE::API::Template; my $Template = DE_EPAGES::TLE::API::Template->new; my $Content = $Template->process( 'PageTemplate.html', \%TemplateVars ); use DE_EPAGES::TLE::API::Template qw (ProcessFileTemplate); my $Content = ProcessFileTemplate('myTemplate.tmpl', \%TemplateVars); |
@EXPORT_OK |
Functions
INCLUDE
Simple include on file base. If the debugging mode for this function is enabled, an html comment wraps result (includes file name and processing time).
Syntax |
$Content = $Handler->INCLUDE($Processor, $raParams); #INCLUDE("FileName") |
Example |
#INCLUDE("myIncludeTemplate.tmpl") |
Input |
|
Return |
|
ProcessFileTemplate
Starts the template processing, which is based on template $FileName. At this template are allowed calls of INCLUDE.
Syntax |
$Content = ProcessFileTemplate($FileName, $hVars, $TLEProcessor); |
Input |
|
Return |
|
SavedInclude
Caches the content of the block in a static file. The cached content can be reused in other templates if the file name is equal. The cached files are stored in the same directory as the calling template.
Syntax |
#BLOCK("SavedInclude", #FileName) ... #ENDBLOCK |
Example |
#BLOCK("SavedInclude", "MainMenu") ... #ENDBLOCK |
Input |
|
perlFileName
Returns path to the compiled template for a given template path. This method returns $FileName.'.ctmpl', but it can be overloaded. If the retun value is undef, the compiled template is not saved to disk.
Syntax |
$PerlFile = $Template->perlFileName( $FileName ); |
Example |
$PerlFile = $Template->perlFileName( 'Template.tmpl' ); |
Input |
|
Return |
|
process
Replaces TLE variables in the template.
Syntax |
$Template = $Package->new; $Content = $Template->process( $FileName, $hVars ); |
Input |
|
Return |
|