asp+fso生成html分页问题。急。。。

来源:百度知道 编辑:UC知道 时间:2024/06/19 20:45:31
<!--#include file="conn.asp"-->
<%
Dim fso,htmlwrite
Dim strOut

'查询数据库
set rs=server.CreateObject("adodb.recordset")
sql="select * from Product order by ArticleID desc"
rs.open sql,conn,1,1
do while not rs.eof
'// 创建文件系统对象
Set fso=Server.CreateObject("Scripting.FileSystemObject")
'// 打开网页模板文件,读取模板内容
Set htmlwrite=fso.OpenTextFile(Server.MapPath("Case.html"))
strOut=htmlwrite.ReadAll
htmlwrite.close

strTitle=""&rs("Title")&""
strContent=""&rs("Content")&""
strTime=""&rs("UpdateTime")&""

'// 用真实内容替换模板中的标记
strOut=Replace(strOut,"$Title$",strTitle)
strOut=Replace(strOut,"$Content$",strContent)
strOut=Replace(strOut,"$UpdateTime$",strTime)
newname="

我给你Email里发过去了一个小程序,你看一下对你能不能帮上忙吧。

'// 用真实内容替换模板中的标记
strOut=Replace(strOut,"$Title$",strTitle)
strOut=Replace(strOut,"$Content$",strContent)
strOut=Replace(strOut,"$UpdateTime$",strTime)
newname=""&rs("ArticleID")&""&".html"
'// 创建要生成的静态页
formPath="/"

要实现很难的。因为HTML是通过内容替换实现的,要是想分页,是把内容分开的,这就需要在替换之前对内容进行分离生成多个HTML,比较难实现的。
不是做成静态HTML就好办。