PHP Classes
elePHPant
Icontem

File: test1.php

Recommend this page to a friend!
  Classes of Gregory  >  QTemplate  >  test1.php  >  Download  
File: test1.php
Role: Example script
Content type: text/plain
Description: Example
Class: QTemplate
Template engine that uses regular expressions
Author: By
Last change: update
Date: 13 years ago
Size: 1,058 bytes
 

Contents

Class file image Download
<?
////////////////////////////////////////////////////////////////
// QTemplate example :: recurse template parsing
// (c) Gregory A. Rozanoff, 2003
////////////////////////////////////////////////////////////////

include "class.template.inc";

function
getmicrotime() {
    list(
$usec, $sec) = explode(" ",microtime());
    return ((float)
$usec + (float)$sec);
}

$start = getmicrotime();
$phrase = "Quick Template is a fast, tiny and easy-to-use template engine &copy; by Gregory A. Rozanoff, 2003.";
$words = explode(" ", $phrase);

$tpl = new template("templates.tpl");
$tpl->assign("title", $phrase);
$tpl->assign("font_color", "ffff00");
$tpl->assign("color", "336699");

foreach (
$words as $num => $word) {
   
$tpl->assign("index", "word #". (string) $num);
   
$tpl->assign("foo", $word);
   
$tpl->assign("value", "cell");
   
$tpl->assign(".row");
}
$tpl->assign("main");
echo
$tpl->out("main");

$stop = getmicrotime();
$uptime = round(($stop - $start) * 1000000) / 1000;
echo
"\n<!-- Execution time : ".$uptime." mc -->";
?>