Login   Register  
PHP Classes
elePHPant
Icontem

File: README

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Dmitry Levashov  >  YaTemplate  >  README  >  Download  
File: README
Role: ???
Content type: text/plain
Description: synopsys
Class: YaTemplate
Yet another template class
Author: By
Last change:
Date: 2001-10-20 16:48
Size: 1,280 bytes
 

Contents

Class file image Download
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"