boolean
HTML_Template_IT::loadTemplatefile
(
string
$filename
, boolean
$removeUnknownVariables
= = true
, boolean
$removeEmptyBlocks
= = true
)
Lädt ein Templatefile und generiert intern Block- und Variablenlisten
string $filename - Dateiname des zu ladenden Templates.
boolean $removeUnknownVariables - Wenn TRUE werden nicht zugewiesene Platzhalter in der Ausgabe entfernt, andernfalls bleiben diese sichtbar.
boolean $removeEmptyBlocks - Wenn TRUE, werden Blöcke, die keine Platzhalter enthalten und nicht durch HTML_Template_IT::touchBlock() gekennzeichnet sind, entfernt.
boolean - Returns TRUE on success, FALSE on failure.
Templatefile main.tpl.htm
<html> <body> User {USERNAME} logged in successfull as {ROLE}. </body> </html>
Das Script mit $removeUnknownVariables = FALSE
<?php
require_once 'HTML/Template/IT.php';
$tpl = new HTML_Template_IT('.');
$tpl->loadTemplatefile ('main.tpl.htm', false, false);
$tpl->setVariable ('USERNAME', 'foo');
// Placeholder ROLE is not set
$tpl->show();
?>
Die Ausgabe
Das Script mit $removeUnknownVariables = TRUE
<?php
require_once 'HTML/Template/IT.php';
$tpl = new HTML_Template_IT('.');
$tpl->loadTemplatefile ('main.tpl.htm', true, true);
$tpl->setVariable ('USERNAME', 'foo');
// Placeholder ROLE is not set, but $removeUnknownVariables is set to true.
$tpl->show();
?>
Die Ausgabe
This function can not be called statically.