Does anyone know if there is a program or script available that can convert a website consisting of .php webpages and stored in MySQL database to a 'static' .html site?
I think he meant creating new HTML files out of php files so they are static and don't need to connect to database and do processing and other php stuff! not allowing HTML files to be preprocessed with php!
doing this wouldn't be easy! you have to store all contents of the page and then save them into a file with fopen(), fwrite() and fclose() !
__________________ PHPSimplicity
We don't need a reason to help people - Zidane [FF9]
<pre>
<?php
function update($cFile) {
$script = str_replace(".html", "_script.php", $cFile);
$filename = "/home/user/public_html" . $cFile; //replace this with the absolute path to your root web folder eg. htdocs, etc.
$myFile = fopen($filename,'w+');
if (!$myFile){
print ("File could not be opened.");
exit;
}
$string = shell_exec("/usr/bin/curl -L http://www.yoursite.com" . $script);
//$string = str_replace("\t", "", $string); //any replacements
//$string = str_replace("\n", "", $string);
//$string = str_replace(" ", "", $string);
fputs($myFile, $string);
fclose($myFile);
echo "Updated - " . $cFile . "\n";
}
# IMPORTANT: Must have leading slash
//example: the following would convert index_script.php (dynamic) to index.html (static)
update("/business/wholesalers/index.html");
//have as many as you want
update("/dir1/file2.html");
//would make [url]http://yoursite.com/index.html[/url] from [url]http://yoursite.com/index_script.php[/url]
update("/index.html");
I think he meant creating new HTML files out of php files so they are static and don't need to connect to database and do processing and other php stuff! not allowing HTML files to be preprocessed with php!
doing this wouldn't be easy! you have to store all contents of the page and then save them into a file with fopen(), fwrite() and fclose() !
If your correct, how about view source code of the php (not relative, HTTP way, so you will get the html and not the actual php code ) file and write the code to an .html file?