<< adsense 国内热门高价关键词从《宫心计》看TVB剧本30年无进步 >>

asp 生成静态文件

模板文件:Templet.htm

"http://www.w3.org/TR/html4/loose.dtd">


$title$--$SiteUrl$






$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
%>

2009-11-14 18:4:16 | 发布:ntsem | 分类:电子商务实战 | 评论:0 | 引用:0 | 浏览:
  • 相关文章:
Auto Publisher Copyright 2008-2010 苏ICP备09044516号
点击发起会话
时间:7:30-18:00
  • 域名空间基础
  • 网站建设服务
  • 网站优化推广