Implementation of static HTML technology for PHP Dynamic Web page

Source: Internet
Author: User

<?php
/*____ Generate HTML file ________beign__________*/
if ($make _html)
{
$buffer = Ob_get_flush ();
if ($go _html)//whether directly to the HTML file display or PHP read content output (0:php read content Output 1: Direct turn)
{
/*__ handles the problem of the seed path caused by generating HTML files ______begin_______*/
$search = Array (
"/(src=|action=|href=|ajaxread\ () \"/ie ",
"/\.\.\./e",
"/\.\/\./e",
"/\.\.\/http:\/\//ies",
"/\.\.\/#/",
"/\ ' \.\ '/e",
"/\.\.\/javascript:/ies");

$replace = Array (
"' \\1\". /'",
"'..'",
"'.'",
"' http://'",
"#",
"'\'.. \''",
"' javascript: '");
$buffer = Preg_replace ($search, $replace, $buffer);
/*___ handles the problem of the seed path caused by generating HTML files _____end_____*/
}

$fp = fopen (html_file, "w");
if ($FP)
{
Fwrite ($fp, $buffer);
Fclose ($FP);
}
}
/*_______ Generate HTML file _________beign________*/
?>

<?php
Ob_start ();
/*____ determines whether an HTML file has been generated, and jumps to an HTML page if it is generated ___begin_____*/
$qstring = Isset ($_server["query_string"])? $_server["Query_string"]: "";
if ($qstring)//program adds a GET request processing
{
$qstring = str_replace ("=", "", $qstring);
Define ("Html_file", "./h/{$efilename}-{$qstring}.html");
}
Else
{
Define ("Html_file", "./h/{$efilename}.html");
}
if (file_exists (html_file))
{
$LCFT = Filemtime (html_file);//last Create FILE time
if ($LCFT + 3600) > Time ())//To determine whether the last generation of HTML file in the past 1 times, if not to output directly the contents of the file
{
if ($show _html)//is displayed in an HTML static page (0 does not show HTML display 1 with HTML display)
{
if ($go _html)//whether directly to the HTML file display or PHP read content output (0:php read content Output 1: Direct turn)
{
Header ("Location:"). html_file);/Direct turn
}
Else
{
Echo (file_get_contents (html_file));//Read exhibited
}
Exit (0);
}
}
}
/*___ determines whether an HTML file has been generated, and jumps to an HTML page if it is generated _____end_____*/
?>

<?php
Require ("woods-thtml.php");//Generate HTML Processing headers
if (count ($_get) < 1 && count ($_post) < 1) {require ("woods-thtml.php"); Generate HTML Processing headers

Require ("{$exec _file}");//Register language definition file
foreach ($lang as $key => $value)
{
$ATPL [Strtoupper ($key). " _lang "] = $value;
}
/*__________ list Common sense go up the item _______end_______*/
Include ("woods-templates.php");
$TPL = new Woodstpl ("./templates/");
$tpl->require_tpl ("header.html");
$tpl->set_file ();
$tpl->block ("Ebcorp", $scorp);
$tpl->block ("NEWS", $news);

$tpl->block ("PRODUCT", $product);
$tpl->block ("Ebpname_msg", $spname);

$tpl->block ("lore", $lore);
$tpl->require_tpl ("footer.html");
$tpl->parse ($ATPL, true);
$TPL = NULL;
/*_____ Template Operations ________end_____________*/
Require ("woods-bhtml.php");//Generate HTML processing tail
?>



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.