<?php
 
include("cls_ft_cache.php");
 
//call this page with different parameters 
 
//like ftc_test.php?t=1 or t=2,etc.. to see how context
 
//work.You will see the cache files in the cache folder.
 
//If they don't show up,then change the max_runtime to 
 
//something like 0.0002
 
//See the class file for more info...
 
 
$ft=new ft_cache(".",".");
 
//play with this and the for loop value
 
//but don't forget to clear already cached files
 
//or change the timestamp (touch()) of cache.info file
 
//from your cache folder.
 
$ft->max_runtime=1; //one seccond
 
$ft->init();
 
$ft->define(array('main' => 'a_static.html','row' => 'b_static.html'));
 
//check if a cache was found.If so the 
 
//hang the script here.Also instead of ft_print() we can get 
 
//the cache content in a var and do other actions on it...
 
if($ft->cache)
 
{
 
     echo "Page served from cache.<br>";
 
     $ft->ft_print('_CACHE_');
 
     die();
 
}
 
//from here on is normal template use.
 
$ft->assign("HEADER",'Cached Test');
 
for($i=1;$i<3000;$i++)
 
{
 
    $ft->assign('CELL_TEXT',$i);
 
    $ft->parse('TABLE_ROWS','.row');
 
}
 
$ft->parse('MAIN','main');
 
$ft->ft_print('MAIN');
 
?>
 
 |