Generating Static Pages || Preserve PHP Code?
| From: | CF High | Date: | Tue, 10 Jun 2003 22:32:31 +0000 |
| Subject: | Generating Static Pages || Preserve PHP Code? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-150958@lists.php.net to get a copy of this message | ||
Hey all.
Interesting problem here, at least for me ;--):
How to generate php pages using fopen() without having php code evaluated in
the written pages?
For example, if build_pages.php runs a db query and, based on the result
set, produces a test page using fopen(), how to avoid having php code
getting evaluated?
Here's an example snippet:
*********************************************************************
// Set read & write paths
$write_path = "C:\\apache\\htdocs\\client_site\\files\\";
$write_path = $write_path . "example_page.php";
$read_path = $doc_path . "build_pages.php";
// Read file to variable & close
$fr = fopen($read_path, "r") or die("An error occurred while opening
$read_path");
$text = "";
while (!feof($fr)){ $text .= fread($fr, 100000); }
fclose($fr);
// Create example page
$fw = fopen($write_path, "wb") or die("An error occurred while opening
$write_path");
// Write data to example page
$make_page = fwrite($fw, $text);
fclose($fw);
*********************************************************************
Give a holler for more info -- I know the question is a little vague -- I'm
still figuring out how to implement this solution..........
--Noah