ASP Web site generated static HTML page technology Summary _ Application skills
Source: Internet
Author: User
There are only two main steps to generate HTML methods:
First, get the contents of the HTML file to be generated
Save the contents of the obtained HTML file as an HTML file
My main point here is just the first step: How to get the contents of the HTML file to be generated:
There are several ways to get the content of an HTML file at this time:
1,
Str= "str=str& "This approach is written to generate HTML content within the script, it is not easy to preview the content of the generated page, can not visualize the layout page, change the HTML template is more complex.
There are a lot of people in this way, but I feel that this method is the most inconvenient.
2, the production of a separate HTML template page, dynamic content with a specific character as a mark (such as: Someone with $title$ marked as a page title), Load the contents of its template with ADODB.stream or scripting.filesystemobject, and replace it with the original set of tags with dynamic content
Such as:
Replace (loaded template content, "$title $", RS ("title"))
3, use XMLHTTP or ServerXMLHTTP to obtain the HTML content that the dynamic page displays,
I used to generate an instance of an HTML file:
'-----------------Shangai (Xiao-qi)
' Weburl is the dynamic page address to get
' Gethttppage (weburl) is a function to get the contents of a dynamic page
Weburl= "http://" &request.servervariables ("SERVER_NAME") & "/contact.asp?id=" &rs ("id") & "" ' Specify dynamic page address
Body=gethttppage (Weburl) ' The contents of a dynamic page address with a function
'-----------------Shangai (Xiao-qi)
The biggest advantage of this method is not to use the effort to write static template page, only the original dynamic page into the HTML static page, but the production speed is not too fast.
My common method of generating HTML is the 3rd: use XMLHTTP to get the HTML content generated by the dynamic page, and then save it as an HTML file with ADODB.stream or Scripting.FileSystemObject.
The second step is the method of generating the file:
Common useful adodb.stream generated files and Scripting.FileSystemObject generated files in ASP two kinds
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.