有关ASP生成HTML的问题
下面是生成页面的代码:<%'容错处理
On Error Resume Next
%>
<!--#include file="conn.asp" -->
<!--#include file="lib.asp" -->
<%
Set rs = Server.CreateObject ("ADODB.Recordset")
sql = "Select * from c_news where c_id=4"
rs.Open sql,conn,1,1
New_list = "<table width=""500"" border=""0"" cellspacing=""0"" cellpadding=""5"">" & vbCrLf
New_list = New_list & " <tr>" & vbCrLf
New_list = New_list & " <td width=""30"" align=""left"" valign=""middle"">· </td>" & vbCrLf
New_list = New_list & " <td align=""left"" valign=""middle"">" & vbCrLf
New_list = New_list & rs("c_title")
New_list = New_list & "</td>"&vbCrLf
New_list = New_list & " <td width=""100"" align=""center"" valign=""middle"">" & vbCrLf
New_list = New_list & year(rs("c_time")) &"-"& month(rs("c_time")) &"-"&day(rs("c_time"))
New_list = New_list & "</td>"&vbCrLf
New_list = New_list & " </tr>" & vbCrLf
New_list = New_list & "</table>" & vbCrLf
New_list = New_list & ""
rs.close
Set rs = Nothing
conn.close
set conn=Nothing
%>
<%'生成HTML文件名,建立文件夹,指定文件路径
fname = makefilename(now()) 'makefilename为自定义函数
folder = "newsfile/"&date()&"/"
filepath = folder&fname
%>
<%'打开模板代码,并将其中特殊代码转变为接受值
sql1="select m_id,m_html from c_moban where m_id=2"
set rs1=Server.CreateObject("adodb.recordset")
rs1.open sql1,conn,1,1
mb_code=rs1("m_html")
rs1.close
set rs1=nothing
conn.close
set conn=nothing
list=list
mb_code=replace(mb_code,"$New_list$",New_list)
%>
<%'生成HTML页面
Set fso = Server.CreateObject("Scripting.FileSystemObject")
fso.CreateFolder(Server.MapPath(folder))
Set fout = fso.CreateTextFile(Server.MapPath(filepath))
fout.WriteLine mb_code
fout.close
%>
<%=New_list%>
文章添加成功,<a href="<%=filepath%>">浏览</a>
数据库中的模板内容:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=hz">
<title>无标题文档</title>
</head>
<body>
<table width="400" height="300" border="0" cellpadding="0" cellspacing="0">
<tr>
<td height="30" style="border:1px solid #cccccc">新闻列表</td>
</tr>
<tr>
<td align="left" valign="top" style="line-height:20px; border-bottom:1px solid #cccccc; border-left:1px solid #cccccc; border-right:1px solid #cccccc">$New_list$</td>
</tr>
</table>
</body>
</html>
代码中数据库中的字段和内容都没有错...执行完就生成一个空的文件...
请斑竹帮忙看看