function getmicrotime(){
list($usec, $sec) = explode(" ",microtime());
return ((float)$usec + (float)$sec);
}
$time_start = getmicrotime();
include ("vtemplate.class.php");
$max=35;
$temp=New VTemplate;
$vtp_main = $temp->Open("test.vtp");
$vtp_1 = $temp->Open("mul.vtp");
$vtp_2 = $temp->Open("mul.vtp",CACHED,30);
$vtp_3 = $temp->Open("mul.vtp",CACHED,40);
echo "
Temps de parsing: ".(getmicrotime()-$time_start)." secondes
";
$temp->setGlobalVar(ALL,"sid", "SID");
$handle=array($vtp_1,$vtp_2,$vtp_3);
$titre=array("Addition","Soustraction","Division","Multiplication");
$operation=array("\$i+\$j","\$i-\$j","round(\$i/\$j,2)","\$i*\$j");
for ($z=0;$z<3;$z++){
$vtp=$handle[$z];
if ( !$temp->isCached($vtp) ){
for($a=0;$a<=3;$a++){
$temp->AddSession($vtp,"GAL");
$temp->setVar($vtp,"GAL.titre",$titre[$a]);
for($i=0;$i<=$max;$i++){
$temp->AddSession($vtp,"multiplication");
$temp->AddSession($vtp,"tete");
if ($color=="FFFFFF") $color="DDDDDD"; else $color="FFFFFF";
$temp->setVar($vtp,"tete.val1",$i);
$temp->setVar($vtp,"multiplication.color",$color);
$temp->setVar($vtp,"multiplication.val1",$i);
for($j=0;$j<=$max;$j++){
$temp->AddSession($vtp,"unite");
@eval("\$res=".$operation[$a].";");
$temp->setVar($vtp,"unite.mul",$res);
$temp->CloseSession($vtp,"unite");
}
$temp->CloseSession($vtp,"tete");
$temp->CloseSession($vtp,"multiplication");
}
$temp->CloseSession($vtp,"GAL");
}
}
}
$temp->Parse($vtp_main,"fichier1",$vtp_1);
$temp->Parse($vtp_main,"fichier2",$vtp_2);
$temp->Parse($vtp_main,"fichier3",$vtp_3);
$temp->Display($vtp_main);
echo "
Temps d'excution: ".(getmicrotime()-$time_start)." secondes
";
?>