用如下方法(FSO)可以生成:
index.asp
(生成静态页代码)
-----------------------------------------------------------
<%
fname="template.htm"
dim replaceweb(2)
replaceweb(0)="haha"
replaceweb(1)="模版生成静态页面"
replaceweb(2)="模版生成静态页面实例"
set fso=server.createobject("scripting.filesystemobject")
set file=fso.opentextfile(server.mappath(fname),1,True)
FSOFileRead = file.ReadAll
set file=nothing
for i=0 to 2
FSOFileRead=Replace(FSOFileRead,"$HTMLWEB["&i&"]",replaceweb(i))
next
Set outfile = fso.CreateTextFile(Server.Mappath("newweb.htm"))
outfile.Write FSOFileRead
outfile.close
Set outfile=nothing
Set fso=nothing
%>
template.htm
(模板)
----------------------------------------------------
<html>
<head>
<title>$HTMLWEB[0]</title>
</head>
<body>
<center>
<h1>$HTMLWEB[1]</h1><hr>
$HTMLWEB[2]
</center>
</body>
</html>