inicio mail me! sindicaci;ón

ASP makes technology of static Html file

The webpage generates static Html file to have a lot of profit, generate Html webpage to be helpful for be being collected by search engine for instance, what be collected not only is fast what still collect is complete. Broke away from data visit downstage, ease the pressure that visits to the database, accelerate a webpage to open career.

Resemble Www.aspid.cn advocate the station used TSYS to make Html file!

Chant Qing Dynasty is the so closest be interested in generate Html quite, read many articles, also have little results.

1, this example uses FSO to write Html code into the file that makes.html form next in the file directly below

<%Filename= “test.htm “If Request("body" )<>”" ThenSet Fso = Server.CreateObject(”Scripting.FileSystemObject” )Set Htmlwrite = Fso.CreateTextFile(server.mappath("" &filename&Htmlwrite.write "<html><head><title> "&Request.form(”title” )&"</title></head> "Htmlwrite.write "<body> outputs Title content: Htmlwrite.write “ outputs Title content:: &Request.form(”title” )&"<br />Output Body content:” &Request.form(”body” )&"</body></html> "Htmlwrite.closeSet Fout=nothingSet Fso=nothingEnd If

%>

<form Name= "form" Method= "post" Action= "" >

<input Name= "title" Value= "Title" Size=26>

<br>

? <textarea Name= "body" >Body</textarea>

? <br>

? <br>

? <input Type= "submit" Name= "Submit" Value= " generates Html" >

</form>

2, but make Html file according to the method above special inconvenience, the 2nd kind of method uses pattern plate technology namely, replace the cost of special code in pattern plate for from express sheet or be a database the value that come over is accepted in the field, the code of all pattern plate that; of function of the pattern plate that finish will replaced finally makes HTML file. This kind of technology is used morer, major CMS is to use this kind of method. File of pattern plate of Template.htm ‘ //

<html>

<head>

<title>$title$ By Aspid.cn</title>

</head>

<body>

$body$

</body>

</html>

TestTemplate.asp ‘// generates Html

<%

Dim Fso, htmlwrite

Dim StrTitle, strContent, strOut

‘// establishs file system target

Set Fso=Server.CreateObject(”Scripting.FileSystemObject” )

‘// opens file of webpage pattern plate, read take pattern plate content

Set Htmlwrite=fso.OpenTextFile(Server.MapPath(”Template.htm” ) )StrOut=f.ReadAllHtmlwrite.close

The webpage headline that StrTitle= ” makes “The webpage content that StrContent= ” generates “

‘// replaces the number in pattern plate with true contentStrOut=Replace(strOut, “$title$” , strTitle)StrOut=Replace(strOut, “$body$” , strContent)

‘// founds the static page that should make

Set Htmlwrite=fso.CreateTextFile(Server.MapPath(”test.htm” ) , true)

‘// keeps webpage contentHtmlwrite.WriteLine StrOutHtmlwrite.close

Response.Write ” makes static page success! Response.Write ” makes static page success!!

In all 2 pages: On one page 1[2] Issue one page

Bookmark:Digg Del.icio.us Reddit

Leave a Comment