CodeCharge Studio
search Register Login  

Visual PHP Web Development

Visually Create Internationalized Web Applications, Web Reports, Calendars, and more.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> General/Other

 php to html

Print topic Send  topic

Author Message
Jimmy
Posted: 02/21/2006, 12:20 PM

Can you show me how to save php page output (web report) on the server in html format using program not save as. I look at the pervious post of http://forums.codecharge.com/posts.php?post_id=25411
and http://forums.codecharge.com/posts.php?post_id=43588 but I still not able to understand it.

Did anyone had an simple example or something?

Please help. Thanks
EMGz
Posted: 02/22/2006, 2:18 PM

Here is a function that takes an array of dynamic pages and creates static html copies on the server:

function generate_final_report(){

// make array of all final report page names (php files)
$files = array("Appeals.php","BasicInformation.php","Comparisons.php",
"Compliance.php","Costs.php","Default.php","Fees.php",
"InitialRequests.php","Statutes.php","Terms.php");

// read each page in the array and ...
$msg = "";
foreach($files as $key=>$val){

$content = file_get_contents("http://vaww.oit.aac.va.gov/foia/AnnualReportFinal/" . $val);

// replace certain text and link attributes
$content = str_replace("../AnnualReportFinal/", "",$content);
$content = str_replace("zTotal", "Total",$content);

// strip session id off end of links
$content = preg_replace("/(\&{0,1}PHPSESSID=\w+)(\&{0,1}\w+){0,1}/","\\2",$content);
$content = str_replace(".php", ".html",$content);
$new_file_name = str_replace(".php", ".html",$val);

// write the content to the static .html file
$url = "E:/web/foia/AnnualReportFinal/PublishableReport/" . $new_file_name;
$htm = fopen($url, "w");
fwrite ($htm, $content);
fclose($htm);
unset($htm);

$msg .= $new_file_name . " - generated successfully<br>";

}

// show a link to the newly created files

$msg .= "<br><br><img src='../images/node.gif' border=0>";
$msg .= "<a href='PublishableReport/Default.html' target='_blank'>Click here to view</a>";

return $msg;

}
jimmy
Posted: 02/22/2006, 3:38 PM

Thank for your help. I will give it a try.
Jimmy
Posted: 02/23/2006, 11:15 AM

The code work great. This is exactly what I wanted. Thank you very much.
Marko
Posted: 03/06/2006, 3:50 PM

But how to use this script? Anybody can say me how to use it and when I'll put it?

//M.S

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

MS Access to Web

Convert MS Access to Web.
Join thousands of Web developers who build Web applications with minimal coding.

CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.