$reqfilename = "index";
$cachefile = "cache/".$reqfilename.".xanadu";
$cachetime = 5 * 60; //5 minutes
// Serve from the cache if it is younger than $cachetime
if (file_exists($cachefile) && (time() - $cachetime < filemtime($cachefile))) {
include($cachefile);
echo "<!-- Cached ".date('jS F Y H:i', filemtime($cachefile))." -->\n";
exit;
}
// start the output buffer
ob_start();
?)
Here is Page-Content home
(?
$fp = fopen($cachefile, 'w'); // open the cache file for writing
fwrite($fp, ob_get_contents()); // save the contents of output buffer to the file
fclose($fp); // close the file
// Send the output to the browser
ob_end_flush();
?)