SYNOPSIS
include "YaTemplate_class.php";
$T = new YaTemplate("/path/to/templates");
or
$T = new YaTemplate(array("/first/path/to/templates", "/second/path/to/templates"));
or
$T = new YaTemplate();
$T->SetDir("/additional/path/to/templates"); - add new templates directory
$T->SetFile("main", "main.html");
or
$T->SetFile(array(main=>"main.html", tb=>"table.html"));
$T->SetVar("TITLE", "Welcome");
or
$T->SetVar(array("CONTENT"=>"Hello world!", "DATE"=>date("d/m/Y", time())));
$T->Parse("OUT", "main");
or
$T->Parse("OUT", "tb", true); - append to "OUT"
or
$T->Parse("OUT", array("main", "tb"));
$T->PrintOut("OUT");
or
$T->PrintOut(); - print last parsed template
or
echo $T->GetVar("OUT");
Dinamic blocks:
$T->SetBlock("main", "my_block");
$T->SetBlockTree("main", array("block1_level1",
"block2_level1"=>array("block1_level2", "block2_level2")));
$T->ParseBlock("block1_level1"); - parse block to the variable whith the same name with append
$T->CleanBlock("block1_level1"); - delete content of the block, but not delete varable named "block_level1"
$T->CleanVar("block1_level1"); - delete variable "block_level1"
|