I see. You'll have a slight problem there, in that it'll not be dynamic if you do so, updating itself on time schedule (if you run a cron job or similar) rather than when the user accesses it. However...
PHP Code:
<?php
$files = file("filelist.txt");
for($i = 0; $i < count($files); $i++) {
ob_start();
include($files[$i]);
$page = ob_get_contents();
ob_end_clean();
if(strpos($files[$i], ".php") > -1) {
$file = fopen(substr($files[$i], -4) . ".html");
fputs($file, $page);
fclose($file);
}
}
?>
This will read files from filelist.txt and, if each has a .php extension, generate a static page, the name of which will be the original filename with a .html extension instead of .php. You could, if you wanted, add in code to walk through your directories. By the way, if you don't have dynamic content in your pages (as it would seem, if you can replace them so easily with static pages) you shouldn't name them .php in the first place. PHP parsing static pages slows down the server response time to no particular use.
Bookmarks