PHP Classes

File: example2.php

Recommend this page to a friend!
  Classes of Dmitry Levashov  >  YaTemplate  >  example2.php  >  Download  
File: example2.php
Role: ???
Content type: text/plain
Description: nested blocks example
Class: YaTemplate
Yet another template class
Author: By
Last change:
Date: 20 years ago
Size: 1,026 bytes


Class file image Download

include "YaTemplate_class.php";

$T = new YaTemplate();

$T->SetFile(array(main=>"main.html", tb=>"table2.html"));

$T->SetBlockTree("tb", array("t_header", row=>"cell"));

$num_rows   = 5;
$num_cells  = 4;

$T->SetVar(array(title=>"Example 2",
                header_text=>"Example of nested blocks")


for ($i=1; $i<=$num_rows; $i++)
    if ($i % 2)
    $row_color = "#c9edfb";
    $row_color = "#cec7fb";

    $T->SetVar("row_color", $row_color);

    for ($j=1; $j<=$num_cells; $j++)
        $T->SetVar("text", "Row $i Cell $j");


$T->Parse("row", "t_header", true);

$T->CleanBlock(array("row", "t_header"));

$T->Parse("CONTENT", "tb");
$T->Parse("OUT", "main");

$T->Append2Var("OUT", date("m/d/Y H:i:s", time()));


For more information send a message to info at phpclasses dot org.