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

急!关于生成静态页面的问题.
我的数据库中有多条数据,我想通过模板把库中的记录生成到index.html中,经过尝试失败!
模板:

<!DOCTYPE   html   PUBLIC   "-//W3C//DTD   XHTML   1.0   Transitional//EN "   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
<html   xmlns= "http://www.w3.org/1999/xhtml ">
<head>
<meta   http-equiv= "Content-Type "   content= "text/html;   charset=gb2312 "   />
<title> 无标题文档 </title>
</head>

<body>
<a   href= "$File_Path$ "> $Title$ </a>
</body>
</html>

生成静态页面代码:

<!--#include   File= "Conn.asp "-->
<%
Dim   Rs
Set   Rs=server.CreateObject( "ADODB.recordset ")
Rs.open   "Select   *   from   Procducts ",Conn,1,1
Do   until   Rs.eof
Pagetitle=Pagetitle+Rs(1)& " <br> "
FilePath=FilePath+Rs(3)& " <br> "
Rs.MoveNext
loop
For   I=0   to   Rs.recordcount
Set   FSO=Server.CreateObject( "Scripting.FileSystemObject ")
Set   MyFile=FSO.OpenTextFile(Server.MapPath( "IndexTemplet.html "))
TheFile=MyFile.ReadAll
TheFile=replace(TheFile, "$Title$ ",Pagetitle)
TheFile=replace(TheFile, "$File_Path$ ",FilePath)
Set   MyFile=FSO.CreateTextFile(Server.MapPath( "Index.html "))
next
Myfile.writeLine   TheFile
MyFile.close
Set   FSO=nothing
%>
<%Response.Redirect( "Index.html ")%>

生成的页面:

<!DOCTYPE   html   PUBLIC   "-//W3C//DTD   XHTML   1.0   Transitional//EN "   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
<html   xmlns= "http://www.w3.org/1999/xhtml ">
<head>
<meta   http-equiv= "Content-Type "   content= "text/html;   charset=gb2312 "   />
<title> 无标题文档 </title>
</head>

<body>
<a   href= "200765114617.html <br> 200765115017.html <br> 200765113550.html <br> 200765114631.html <br> 200765115027.html <br> 200765115038.html <br> 200765115136.html <br> 200765120320.html <br> 200765123518.html <br> 200765123627.html <br> 200765124106.html <br> 200765124138.html <br> 200765124217.html <br> 200765132337.html <br> 200765132608.html <br> 200765132615.html <br> 200765132620.html <br> 200765132626.html <br> 200765132708.html <br> 200765132718.html <br> 200765132812.html <br> 200765132824.html <br> 200765132831.html <br> 200765132853.html <br> 200765132906.html <br> 200765132914.html <br> 200765132920.html <br> 200765132929.html <br> 200765132937.html <br> 200765132949.html <br> 200765133003.html <br> 200765133434.html <br> 200765133447.html <br> 200765133521.html <br> 200765133534.html <br> 200765133548.html <br> 200765133631.html <br> 200765133639.html <br> 200765133647.html <br> 200765133654.html <br> 200765133707.html <br> 200765133718.html <br> 200765133724.html <br> 200765133728.html <br> 200765133738.html <br> 200765133815.html <br> 200765133823.html <br> 200765133834.html <br> 200765133850.html <br> 200765133904.html <br> "> fxzdcz <br> sdfsdfsdfcxzc &l