TemplateEngine  (since version 2.0)
Type Component
Constants
integer VARTYPE_TABLE = 1
This is a flag for the createVariable method.
Use it with the $type argument if you want to create a variable of the type 'table'.
string VARTYPE_VARIABLE = " 0 "
This is a flag for the createVariable method.
Use it with the $type argument if you want to create a variable of the type 'variable'.
Description
This template engine is a powerfull tool for recycling HTML/XML/text template for many cases.
You can create template with conditional block, foreach loop and template variables.
So it is possible to use exactly the same template for a lot of various outputs and with various contents.
Examples
<?php
    $tpl 
BRICKOO::GetObject ('TemplateEngine');
    
    
// Creating 2 new variables.
    
$tpl->setVariable ('test' '123');
    
$tpl->setVariable ('blup' '456');
    
    
// Creating a table.
    
$tpl->setTable ('mytable' 'name' 'walter' 0);
    
$tpl->setTable ('mytable' 'age' '32' 0);
    
$tpl->setTable ('mytable' 'name' 'ernst' 1);
    
$tpl->setTable ('mytable' 'age' '39' 1);
    
    
// Rendering.
    
echo $tpl->render ("<b></b><br /><if conditionleft="" operation="equal" conditionright="bla"><i></i></if><br /><br /><foreach mytable><b>Name:</b> #name#<br /><b>Age:</b> #age#<br /></foreach>"true);
?>

Last change 10/15/2009




Administration