"http://www.w3.org/TR/html4/loose.dtd">
$ID$ | |
$Company$ | $Name$ |
$Ceo$ | |
地址:$Address$ | |
电话:$Tel$ | |
手机:$Mobile$ | |
传真:$Fax$ | |
Q Q:$QQ$ | |
邮箱:$Email$ |
生成文件:HTML.asp
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<%
function makefilename(fname)
fname = fname '前fname为变量,后fname为函数参数引用
fname = replace(fname,"-","")
fname = replace(fname," ","")
fname = replace(fname,":","")
fname = replace(fname,"PM","")
fname = replace(fname,"AM","")
fname = replace(fname,"上午","")
fname = replace(fname,"下午","")
makefilename = fname & ".html"
end function
%>
<%'生成HTML文件名,建立文件夹,指定文件路径
fname = makefilename(now()) 'makefilename为自定义函数
folder = "Html/"&date()&"/"
filepath = folder&fname
%>
<%'打开模板代码,并将其中特殊代码转变为接受值
set fso=CreateObject("Scripting.FileSystemObject")
set f=fso.OpenTextFile(server.mappath("Templet.htm"))
Pencat=f.ReadAll
f.close
set f=nothing
set fso=nothing
Pencat=Replace(pencat,"$ID$","1")
Pencat=Replace(pencat,"$Company$","黑夜博客")
Pencat=Replace(pencat,"$Name$","黑夜")
Pencat=Replace(pencat,"$Ceo$","黑夜")
Pencat=Replace(pencat,"$Address$","贵州"
Pencat=Replace(pencat,"$Tel$","0851-******")
Pencat=Replace(pencat,"$Fax$","0851-*******")
Pencat=Replace(pencat,"$QQ$","138845152")
Pencat=Replace(pencat,"$Email$","flash165@126.com")
Pencat=Replace(pencat,"$Mobile$","135********")
Pencat=Replace(pencat,"$title$","名片")
Pencat=Replace(pencat,"$SiteUrl$","http://www.gziu.com")
%>
<%'生成HTML页面
Set fso = Server.CreateObject("Scripting.FileSystemObject")
fso.CreateFolder(Server.MapPath(folder))
Set fout = fso.CreateTextFile(Server.MapPath(filepath))
fout.WriteLine Pencat
fout.close
Response.write "生成HTML页面成功"&"
"
Response.write filepath
%>