Fast static html library generated using PHP

Source: Internet
Author: User

CopyCode The Code is as follows: <? PHP
//////////////////////////////////////// ///////////////////////////////////////
//
// Zhang Shulin-Huijia Studio
//
// Module name: woods-bhtml.php
// Abstract: generate static HTML processing Program Tail bottom
// Version 2.0
// Date 1006-11-25
// Author: woods · Zhang
// Website: http://www.hoojar.com/
// Email: hoojar@53.com
// MSN: hoojar@hotmail.com
// Copyright 1001-1006, hoojar studio All Rights Reserved
//
// Copyright 1001-1006, all rights reserved by Huijia Studio

// The software for Free Software, allowing use, copy,
// Modify and distribute the software and files. Any
// Use of this software must place a copy of all
// Above copyright notice. By the software Huijia Studio
// Maintenance, If you have any queries please contact us.
// Thank you.
//
// This software is a free software that allows the use, copying, modification, and distribution of the software and its documentation.
// All copies of the above copyright notice shall appear wherever the software is used. This software is developed
// Maintain Huijia studio. If you have any questions, please contact us. Thank you for using it.
//
//////////////////////////////////////// ///////////////////////////////////////
// This file can only be loaded at the end of the program
/* ________________ Generate the HTML file ______________________ beign ________________________________*/
If ($ make_html)
{
$ Buffer = ob_get_flush ();
If ($ go_html) // whether to directly convert to HTML file display or PHP read content output (0: PhP read content output 1: directly convert)
{
/* __________ Handle the path problem arising from the generation of 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 );
/* __________ Handle the path problem arising from the generation of HTML files ____________________ end _______________*/
}

$ Fp = fopen (html_file, "W ");
If ($ FP)
{
Fwrite ($ FP, $ buffer );
Fclose ($ FP );
}
}
/* ________________ Generate the HTML file ______________________ beign ________________________________*/
?>

<? PHP
//////////////////////////////////////// ///////////////////////////////////////
//
// Zhang Shulin-Huijia Studio
//
// Module name: woods-thtml.php
// Abstract: generate a static HTML processing program Header
// Version 2.0
// Date 1006-11-25
// Author: woods · Zhang
// Website: http://www.hoojar.com/
// Email: hoojar@53.com
// MSN: hoojar@hotmail.com
// Copyright 1001-1006, hoojar studio All Rights Reserved
//
// Copyright 1001-1006, all rights reserved by Huijia Studio

// The software for Free Software, allowing use, copy,
// Modify and distribute the software and files. Any
// Use of this software must place a copy of all
// Above copyright notice. By the software Huijia Studio
// Maintenance, If you have any queries please contact us.
// Thank you.
//
// This software is a free software that allows the use, copying, modification, and distribution of the software and its documentation.
// All copies of the above copyright notice shall appear wherever the software is used. This software is developed
// Maintain Huijia studio. If you have any questions, please contact us. Thank you for using it.
//
//////////////////////////////////////// ///////////////////////////////////////
// This file can only be loaded at the beginning of the program
Ob_start ();
/* ___________ Determine whether an HTML file has been generated. If an HTML file has been generated, the page will jump to the HTML page ___________ begin __________*/
$ Qstring = isset ($ _ server ["QUERY_STRING"])? $ _ Server ["QUERY_STRING"]: "";
If ($ qstring) // The program adds 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 () // determines whether the last HTML file was generated for the past 1 time. If not, the file content is output directly.
{
If ($ show_html) // whether to display static html pages (0 is not displayed in HTML, 1 is displayed in HTML)
{
If ($ go_html) // whether to directly convert to HTML file display or PHP read content output (0: PhP read content output 1: directly convert)
{
Header ("Location:". html_file); // directly convert
}
Else
{
Echo (file_get_contents (html_file); // read display
}
Exit (0 );
}
}
}
/* ___________ Determine whether an HTML file has been generated. If an HTML file is generated, the page will jump to the HTML page ___________ end __________*/
?>

<? PHP
//////////////////////////////////////// ///////////////////////////////////////
//
// Zhang Shulin-Huijia Studio
//
// Module name: index. php
// Abstract: Home Page Information
// Version 1.0
// Date 2006-11-7
// Author: woods · Zhang
// Website: http://www.hoojar.com/
// Cemail: hoojar@163.com
// MSN: hoojar@hotmail.com
// Copyright 2001-2006, hoojar studio All Rights Reserved
//
// Copyright 2001-2006, all rights reserved by Huijia Studio

// The software for Free Software, allowing use, copy,
// modify and distribute the software and files. any
// use of this software must place a copy of all the
// above copyright notice. by the software Huijia studio
// maintenance, If you have any queries please contact us.
// thank you.
// This software is a free software that allows you to use, copy, modify, and distribute the software and its documents.
// all copies of the above copyright notice shall appear in any place where the software is used. This software is maintained by
// Huijia studio. If you have any questions, please contact us. Thank you for using it.
//////////////////////////////// //////////////////////////////////////// //////
require ("woods-thtml.php "); // generate an HTML processing header
// If (count ($ _ Get) <1 & count ($ _ post) <1) {require ("woods-thtml.php");} // generate an HTML processing header

Require ("{$ exec_file}"); // register the language definition file
Foreach ($ Lang as $ key => $ value)
{
$ Atpl [strtoupper ($ key). "_ Lang"] = $ value;
}
/* ________________________________________________ List items going up with common sense _____________________*/
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 the end of HTML processing
?>

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.