The best way to do this, I think, would be to use use url rewrite to make it look like you have static pages when you don't. But if you were having database performance trouble and therefore wanted to cache a static copy of the file, you can also use the ob_ functions to cache a PHP file. Say for instance you only want to read the database once a day and cache the file, and the rest of the time just return the static cached file.
Pseudo-code for that:
$cached_file_path = 'some path for cached file';
//would use filemtime($cached_file_path) and time() to determine if file was
//cached today. could also do it every 3 hours, or whatever
If file has not been cached today or cachefile does not exist, then
{
ob_start(); // starts recording the output in a buffer
//do all your database reads and echos
.....
$contents = ob_get_contents(); // gets all the output for you to write into a file
//save contents to file at $cached_file_path
....
ob_end_flush(); // returns the content to client
exit;
}
else
{
//just serve the cached file
include($cached_file_path);
exit;
}
Obviously you have to take parameters into account since they'll affect the name of the cache-file.