日期:2014-05-17  浏览次数:21109 次

asp如何可以实现静态面页的生成.最好有原程序这样子我学得快
asp如何可以实现静态面页的生成.最好有原程序这样子我学得快

------解决方案--------------------
http://www2.flash8.net/teach/5209.htm

网上很多

http://www.google.com/search?hl=zh-CN&q=asp+%E7%94%9F%E6%88%90%E9%9D%99%E6%80%81%E9%A1%B5&lr=
------解决方案--------------------
<%
'=============================文件生成相关配置 开始====================================
dim sitepath,homepath,newspath,newslist
sitepath = Server.MapPath( "/ ")
homepath = sitepath& "\html\home\ "
newspath = sitepath& "\html\news\ "
newslistpath = sitepath& "\html\newslist\ "
'=============================文件生成相关配置 结束====================================
function makefile(filetype)
sitepath = Server.MapPath( "/ ")
select case filetype
case "1 "
'首页文件
template = sitepath& "\html\temp\home.shtml "
filename = sitepath& "\html\home\ "
case "2 "
'新闻列表及分页
template = sitepath& "\html\temp\newslist.shtml "
filename = sitepath& "\html\newslist\list "&classid& "_ "&pageNo& ".shtml "
case "3 "
'新闻显示页面
template = sitepath& "\html\temp\news.shtml "
end select
Set fso = Server.CreateObject( "Scripting.FileSystemObject ")
'读取模板的内容
Set ftemp=fso.OpenTextFile(template, 1)
pencat = ftemp.ReadAll
ftemp.Close
'response.write(bigclassID)
'response.end
'替换掉里面的内容
if pagetitle= " " or isnull(pagetitle) then pagetitle = title& "---中国电子信息教育网 " end if
pencat=replace(pencat, "@pagetitle ",pagetitle)
pencat=replace(pencat, "@title ",title)
pencat=replace(pencat, "@Content ",Content)
pencat=replace(pencat, "@addtime ",addtime)
pencat=replace(pencat, "@Source ",StrSource)
pencat=replace(pencat, "@Author ",Author)
pencat=replace(pencat, "@keywordstr ",Remark)

pencat = replace(pencat, "@bclass ",bigclassname)
pencat = replace(pencat, "@bigclassID ",bigclassID)
pencat = replace(pencat, "@SmallClassID ",SmallClassID)
pencat = replace(pencat, "@add_bclass ", " <a href= " "/html/Column/Column_ "&bigclassID& ".shtml " "> "&bigclassname& " </a> ")
pencat = replace(pencat, "@add_sclass ", " <a href= " "/html/newslist/list "&SmallClassID& "_1.shtml " "> "&smallclassname& " </a> ")

newspath= " "
newspath=sitepath& "\html\news\ "&year(now())& "\ "

If NOT fso.folderexists(newspath) then
fso.createfolder(newspath)
newspath=sitepath& "\html\news\ "&year(now())& "\ "&month(now())& "\ "
fso.createfolder(newspath)
filename=newspath& "\newsview "&makefilename(addtime)& ".shtml "
else
newspath=sitepath& "\html\news\ "&year(now())& "\ "&month(now())& "\ "
If NOT fso.folderexists(newspath) then
fso.createfolder(newspath)
filename=newspath& "\newsview "&makefilename(addtime)& ".shtml "