Dynamic generation of static html files

Source: Internet
Author: User

Dynamic Static generation Html File I. Why do I generate a static page?

Static webpage generationHtmlFile generation has many advantages, suchHtmlWeb pages can be indexed by search engines,Improve website awareness. At the same time, data access is reduced, database access is reduced, and web pages are opened more quickly.

Ii. How to implement it? 1 , Direct read/write

Direct useIoSetHtmlCodeWrite to the file and generate. HtmlFormat File.

Disadvantage: It is difficult to modify a large amount of code.

2 , Template

The second method is to use the template technology to replace the values of special codes in the template with values accepted from form or database fields to complete the template function; generate all the final replaced template codeHtmlFile. This technology is widely used.,MostCMSThis method is used.

Advantage: reduces the amount of code; disadvantage: Suitable for modifying webpages with few content, such as information, only the title, content, and source.


The third method is to useXMLHTTPObtainHtmlContent, ReuseADODB. StreamOrScripting. FileSystemObjectOr save the snapshot technologyHtmlFile.

Advantage: When a dynamic web page is generated, it is savedHtmlIs a by-product of the server. Disadvantage: the application scope is small.

4 , XSL , XML File

The fourth method is to useXSLFile. All formats are defined in this file.ProgramNot processedHtmlAny element in the file. SetXSLFile andXMLFile match to generateHtmlFile.

Advantage: the program does not process anyHtmlElements, easy to modify. Disadvantages:XSLRatioHtmlComplicated production.

Iii. Summary

There are many ways to generate static Web pages. The second method is the most used. I personally think the fourth method is not bad. Each method has advantages and disadvantages and determines the method based on the actual situation. I hope you will give more comments and see what other methods are available.

Mao's nest

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.