Location: PHPKode > scripts > QTemplate > qtemplate/test1.php
<?
////////////////////////////////////////////////////////////////
// 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 -->";
?>
Return current item: QTemplate