Location: PHPKode > scripts > ft classes > ft-classes/test_unit.php
//here is a quick sample and benchmark for a one dymaic block in one file
//create the class object and set the root path
$ft=new FastTemplate('.');
//define one template file
$ft->define(array('main' => 'a_dynamic.html'));
//define the dynaimc block inside the 'main' template

//do a 5000 rows loop and assign $i to a tag... 

$ft->assign('A','5000 row test');
//parse the template.
echo "Printed $z rows in ".microtime_diff($end,$start);
//print and get back here

 * @return float
 * @param a string
 * @param b string
 * @desc (From php manual) compute the microtime diff format.
function microtime_diff($a,$b) {
     list($a_micro, $a_int)=explode(' ',$a);
     list($b_micro, $b_int)=explode(' ',$b);
     if ($a_int>$b_int) {
        return ($a_int-$b_int)+($a_micro-$b_micro);
     } elseif ($a_int==$b_int) {
        if ($a_micro>$b_micro) {
           return ($a_int-$b_int)+($a_micro-$b_micro);
        } elseif ($a_micro<$b_micro) {
           return ($b_int-$a_int)+($b_micro-$a_micro);
        } else {
           return 0;
     } else { // $a_int<$b_int
        return ($b_int-$a_int)+($b_micro-$a_micro);

Return current item: ft classes