PHP Classes

File: example_tabular.php

Recommend this page to a friend!
  Classes of Gianluca Zanferrari   abc template   example_tabular.php   Download  
File: example_tabular.php
Role: Example script
Content type: text/plain
Description: example tabular
Class: abc template
Template engine that replaces tags in PHP scripts
Author: By
Last change:
Date: 14 years ago
Size: 593 bytes
 

Contents

Class file image Download
<?php
/*
* this is an example with tabular data like data from a database; it is passed as multidimensional array where:
* in the 1st level are given the tags to be replaced.
* in the 2nd level the values.
*/

/*
* template processor
*/
require('class_template.php');
$page = new Page("row.html");

for(
$i=0;$i<=3;$i++){
   
$id[] = $i;
}

/*
* here we go; replace all placeholders
*/
$page->replace_tags(array(
               
'id' => $id
               
,'name' => array('john','mary','susy','bob')
                ,
'age' => array('22','45','67','89')
                ),
'loop');

$page->output('ISO-8859-15');
?>