Login   Register  
PHP Classes
elePHPant
Icontem

File: three_color.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Hans Körber  >  Phptempt  >  three_color.php  >  Download  
File: three_color.php
Role: Example script
Content type: text/plain
Description: output of a HTML table with rows in three different colours
Class: Phptempt
Template engine for PHP and Java
Author: By
Last change:
Date: 2003-01-06 22:04
Size: 860 bytes
 

Contents

Class file image Download
<?php
    $data
["name"] = array ("hans""dennis""christine""karl""horst");
    
$data["town"] = array ("T&uuml;bingen""Reutlingen""Paris""Toronto""G&ouml;hlen");

    
// include API:
    
include ("phptempt.php");

    
// include precompiled template:
    
$t = new phptempt ("three_color.inc");

    for (
$i=0$i<sizeof($data["name"]); $i++) {

        
$t->begin ("aBlock");
        if (
$i == 0)
            
$t->begin ("nested1");
        else if (
$i == 1)
            
$t->begin ("nested2");
        else
            
$t->begin ("nested3");

        
// add data to one of the three blocks in turn:
        
$t->addVal ("NAME"$data["name"][$i]);
        
$t->addVal ("TOWN"$data["town"][$i]);

        if (
$i == 0)
            
$t->end ("nested1");
        else if (
$i == 1)
            
$t->end ("nested2");
        else
            
$t->end ("nested3");
        
$t->end ("aBlock");
    }

    
// output template:
    
$t->out ();
?>