We all know that HTML static Web pages are more easily indexed by search engines, dynamic generation of HTML pages, but also to increase the number of Web pages, search engines can be included in the number of more, and then add to improve the quality of the Web page is not what? I think we all know it.
For this, I decided to change the previous Web site construction, Web design methods, after a lot of research and thinking, on a variety of Web page dynamic generation method, I prefer to use the method of label replacement genetic web page.
Label Replacement method: This is my personal understanding of the definition, do not know what others call it, hehe!
The label substitution method is to put your own label in the page template that you have designed, and replace it with the things you need to display. Such as
Template file 1
This template we keep in the database table temptable
<title>{$SiteName} </title>
<body>
{$Arc_List$}
</body>
In the above template I put two tags {$SiteName} site name and {$ARC _list$} article list, and then look at the following code
<%
Dim rs,sitename,arc_list,fso,myfile,filepath,html
Sitename= "My first dynamically generated HTML page"
FilePath = Server.MapPath ("/html/index.html")
Set Rs=server.createobject ("Adodb.recordset")
Rs.Open "SELECT [Temp] from temptable,conn,1,1
html = rs ("temp") reads a page template
Rs.close
HTML = replace (HTML, "{$SiteName}", SiteName) ' replaces the {$SiteName} label with a custom SiteName
html = HTML & replace (HTML, "{$ARC _list$}", Get_arclist ()) ' Replaces {$ARC _list$} label with a custom Get_arclist () function
Set rs=nothing
Conn.close
Set conn=nothing
Set Fso=createobject ("***ing. FileSystemObject ")" Create File system objects
Set MyFile = fso. CreateTextFile (filepath,true) ' Create file
MyFile.WriteLine (HTML) ' writes HTM code to file
Myfile.close ' Close file
Set MyFile = Nothing ' Frees file objects
Set fso = Nothing ' Frees System file objects
Response.Write "<*** language= ' java*** ' >window.alert (' file build succeeded ');</***>"
Response.End ()
Function get_arclist ()
Dim str,str1
Str1= ""
str = "<ul>{list}</ul>"
Rs.Open "Select Title,url from ARC"
While not rs.eof
str1 = str1 & "<li><a href=" &rs ("url") & ">" &rs ("Title") & "</a></li>"
Rs.movenext
Wend
Rs.close
str = replace (str, "{list}", STR1)
Get_arclist = str
%>
End Function
The above method is not very simple, now many CMS are using this method to generate static Web pages, this method of using more flexible, as long as you carefully design your system, after the Web to do a website, as long as the design template on it ... Oh, Yu now a website construction company work, have free time will write a little dongdong, Yu qq:645556964, welcome to be friends to discuss exchanges, hehe