Forum Moderators: coopster
<?PHP
for($i = 0; $i < 5; $i++)
{
?>
<?php
$page = $i . "_test_page.htm";
$file = 'blank.htm';
$newfile = $page;
if (!copy($file, $newfile)) {
echo "failed to copy $file...\n";
}
?>
<?php
ob_start(); // start the output buffer
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Test Generate Page <?PHP echo $i;?></title>
</head>
<body>
<P>This is a test page.</P>
<P>This is a test page.</P>
<a href="#">This is a test link.</a>
</body>
</html>
<?php
$cachefile = $page;
$fp = fopen($cachefile, 'w'); // open the cache file "cache/home.html" for writing
fwrite($fp, ob_get_contents()); // save the contents of output buffer to the file
fclose($fp); // close the file
ob_end_flush(); // Send the output to the browser
?>
<?PHP }?>