Location: PHPKode > scripts > ft classes > ft-classes/mixed_sample.php
//get the ft object
$ft=new FastTemplate(".");

//define template files.
$ft->define(array('main'=>'a_mixed.html','row' => 'b_mixed.html'));

//define a dynamic block in "row" template
//parse the 5000 rows in a for loop and assign some values
        //now parse the "c_row" in "append" mode.
        //this is done by adding a "."(dot) in front of "c_row" block
        //we send the output to 'C_OUT'.This tag will be created by the engine
        //in the "row" template.When you parse he's parent("row") the assignation is
        //done automaticaly.
    //now parse the row in "append" mode.
    //this is done by adding a "."(dot) in front of "row" template
    //we send the output to TABLE_ROWS,the tag from the "main" template
    //we now must clear the 'C_OUT' else we get a very big......... result:)

//now assign all values for the "main" template and parse this too.
$ft->assign('HEADER','Two static templates and one dynamic block, 5000 rows test');

echo "Printed $z row(s) in ".microtime_diff($end,$start)." secconds<br>";

//print the content

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