Php reference for generating html static pages

Source: Internet
Author: User
Php reference for generating html static pages

  1. ////////

  2. //
  3. // Zhang Shulin-Huijia Studio
  4. //
  5. // Module Name: woods-bhtml.php
  6. // Abstract: generate the end of the static HTML processing program
  7. // Version 2.0
  8. // Copyright 1001-1006, all rights reserved by Huijia Studio

  9. // The software for free software, allowing use, copy,

  10. // Modify and distribute the software and files. Any
  11. // Use of this software must place a copy of all
  12. // Above copyright notice. By the software Huijia studio
  13. // Maintenance, if you have any queries please contact us.
  14. // Thank you.
  15. //
  16. // This software is a free software that allows the use, copying, modification, and distribution of the software and its documentation.
  17. // All copies of the above copyright notice shall appear wherever the software is used. This software is developed
  18. // Maintain Huijia studio. if you have any questions, please contact us. Thank you for using it.
  19. //
  20. /////////////
  21. // This file can only be loaded at the end of the program
  22. /* -- _ Generate the HTML file ---- beign ----____*/
  23. If ($ make_html)
  24. {
  25. $ Buffer = ob_get_flush ();
  26. If ($ go_html) // whether to directly convert to HTML file display or PHP read content output (0: php read content output 1: directly convert)
  27. {
  28. /* -- _ Handle the path problem caused by generating HTML files -- ______ begin --_*/
  29. $ Search = array (
  30. "/(Src = | action = | href = | ajaxRead \ () \"/ie ",
  31. "/\./E ",
  32. "/\. \/\./E ",
  33. "/\. \. \/Http: \/ies ",
  34. "/\.\.\/#/",
  35. "/\ '\. \'/E ",
  36. "/\. \. \/Javascript:/ies ");

  37. $ Replace = array (

  38. "'\ 1 \"../'",
  39. "'..'",
  40. "'.'",
  41. "'Http ://'",
  42. "#",
  43. "'\'..\''",
  44. "'Javascript :'");
  45. $ Buffer = preg_replace ($ search, $ replace, $ buffer );
  46. /* -- _ Handle the path problem caused by generating HTML files -- ______ end --_*/
  47. }

  48. $ Fp = fopen (HTML_FILE, "w ");

  49. If ($ fp)
  50. {
  51. Fwrite ($ fp, $ buffer );
  52. Fclose ($ fp );
  53. }
  54. }
  55. /* -- _ Generate the HTML file ---- beign ----____*/
  56. ?>

  1. //////////////////////////////////////// ///////////////////////////////////////

  2. //
  3. // Zhang Shulin-Huijia Studio
  4. //
  5. // Module Name: woods-thtml.php
  6. // Abstract: generate a static HTML processing program header
  7. // Version 2.0
  8. // Date 1006-11-25
  9. // Copyright 1001-1006, Hoojar studio All Rights Reserved
  10. //
  11. // Copyright 1001-1006, all rights reserved by Huijia Studio

  12. // The software for free software, allowing use, copy,

  13. // Modify and distribute the software and files. Any
  14. // Use of this software must place a copy of all
  15. // Above copyright notice. By the software Huijia studio
  16. // Maintenance, if you have any queries please contact us.
  17. // Thank you.
  18. //
  19. // This software is a free software that allows the use, copying, modification, and distribution of the software and its documentation.
  20. // All copies of the above copyright notice shall appear wherever the software is used. This software is developed
  21. // Maintain Huijia studio. if you have any questions, please contact us. Thank you for using it.
  22. //
  23. //////////////////////////////////////// ///////////////////////////////////////
  24. // This file can only be loaded at the beginning of the program
  25. Ob_start ();
  26. /* -- Determines whether an HTML file has been generated. If yes, the HTML page -- begin --__*/
  27. $ Qstring = isset ($ _ SERVER ["QUERY_STRING"])? $ _ SERVER ["QUERY_STRING"]: "";
  28. If ($ qstring) // The program adds GET request processing
  29. {
  30. $ Qstring = str_replace ("=", "", $ qstring );
  31. Define ("HTML_FILE", "./h/{$efilename}-{$qstring}.html ");
  32. }
  33. Else
  34. {
  35. Define ("HTML_FILE", "./h/{$efilename}.html ");
  36. }
  37. If (file_exists (HTML_FILE ))
  38. {
  39. $ Lcft = filemtime (HTML_FILE); // last create file time
  40. 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.
  41. {
  42. If ($ show_html) // whether to display static HTML pages (0 is not displayed in HTML, 1 is displayed in html)
  43. {
  44. If ($ go_html) // whether to directly convert to HTML file display or PHP read content output (0: php read content output 1: directly convert)
  45. {
  46. Header ("Location:". HTML_FILE); // directly convert
  47. }
  48. Else
  49. {
  50. Echo (file_get_contents (HTML_FILE); // Read display
  51. }
  52. Exit (0 );
  53. }
  54. }
  55. }
  56. /* -- Determine whether an HTML file has been generated. If an HTML file is generated, the page jumps to the HTML page -- end --__*/
  57. ?>

  1. //////////////////////////////////////// ///////////////////////////////////////

  2. //
  3. // Zhang Shulin-Huijia Studio
  4. //
  5. // Module Name: index. php
  6. // Abstract: home page information
  7. // Version 1.0
  8. // Date 2006-11-7
  9. //
  10. // Copyright 2001-2006, all rights reserved by Huijia Studio

  11. // The software for free software, allowing use, copy,

  12. // Modify and distribute the software and files. Any
  13. // Use of this software must place a copy of all
  14. // Above copyright notice. By the software Huijia studio
  15. // Maintenance, if you have any queries please contact us.
  16. // Thank you.
  17. //
  18. // This software is a free software that allows the use, copying, modification, and distribution of the software and its documentation.
  19. // All copies of the above copyright notice shall appear wherever the software is used. This software is developed
  20. // Maintain Huijia studio. if you have any questions, please contact us. Thank you for using it.
  21. //
  22. //////////////////////////////////////// ///////////////////////////////////////
  23. Require ("woods-thtml.php"); // Generate an HTML processing header
  24. // If (count ($ _ GET) <1 & count ($ _ POST) <1) {require ("woods-thtml.php") ;}// generate an HTML processing header

  25. Require ("{$ exec_file}"); // register the language definition file

  26. Foreach ($ lang as $ key => $ value)
  27. {
  28. $ Atpl [strtoupper ($ key). "_ LANG"] = $ value;
  29. }
  30. /* ------ List common sense items going up -- end ---*/
  31. Include ("woods-templates.php ");
  32. $ Tpl = new WoodsTpl ("./templates /");
  33. $ Tpl-> require_tpl ("header.html ");
  34. $ Tpl-> set_file ();
  35. $ Tpl-> block ("EBCORP", $ scorp );
  36. $ Tpl-> block ("NEWS", $ news );

  37. $ Tpl-> block ("PRODUCT", $ product );

  38. $ Tpl-> block ("EBPNAME_MSG", $ spname );

  39. $ Tpl-> block ("LORE", $ lore );

  40. $ Tpl-> require_tpl ("footer.html ");
  41. $ Tpl-> parse ($ atpl, true );
  42. $ Tpl = NULL;
  43. /* -- _ Template operation ---- end ----*/
  44. Require ("woods-bhtml.php"); // Generate the end of HTML processing
  45. ?>

Articles you may be interested in: three methods for generating static pages in php and code details examples of generating static page functions in php (php2html) php-written static page generation class generates all the content in the database html static page code VM automatically generates static pages on a regular basis php-generated static page detailed tutorial apache access solution to pseudo-static pages: code for generating static pages by using the web crawler record of static pages written by php: smarty method for generating static pages PHP method for generating static pages apache solution for accessing pseudo-static pages

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.