ASP生成静态页面的方法(5)  ASP生成静态页面的方法(5)2006-4-25 18:05:47ASP生成静态页面的方法(5)2006-4-25 18:05:47ASP生成静态页面的方法(5)
ASP生成静态页面的方法(5)
ASP生成静态页面的方法(5)  ASP生成静态页面的方法(5)2006-4-25 18:05:47ASP生成静态页面的方法(5)2006-4-25 18:05:47ASP生成静态页面的方法(5)
|
文谷 www.wengu.com
来源:网络 作者:佚名 时间:2006-4-25 浏览人数:
|
处理 SSI 文件时出错
ASP生成静态页面的方法(5)  ASP生成静态页面的方法(5)2006-4-25 18:05:47ASP生成静态页面的方法(5)2006-4-25 18:05:47ASP生成静态页面的方法(5)
引用:
<%’容错处理 On Error Resume Next %> <!--#include file="conn.asp" --> <!--#include file="lib.asp" --> <%’接受传递值 c_title=request.form("c_title") c_content=request.form("c_content") %> <%’生成HTML文件名,建立文件夹,指定文件路径 fname = makefilename(now()) ’makefilename为自定义函数 folder = "newsfile/"&date()&"/" filepath = folder&fname %> <%’将接受值及路径保持至数据库表 sql = "Select * from c_news" Set rs = Server.CreateObject ("ADODB.Recordset") rs.Open sql,conn,3,2 rs.addnew rs("c_title")=c_title rs("c_content")=c_content rs("c_filepath")=filepath rs.update rs.close Set rs = Nothing %> <%’打开模板代码,并将其中特殊代码转变为接受值 sql1="select m_id,m_html from c_moban where m_id=1" 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 c_title=htmlencode(c_title) c_content=htmlencode(c_content) mb_code=replace(mb_code,"$cntop{LogContent}quot;,now()) mb_code=replace(mb_code,"$cnleft{LogContent}quot;,c_title) mb_code=replace(mb_code,"$cnright{LogContent}quot;,c_content) %> <%’生成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 %> 文章添加成功,<a href="showit.asp"> 浏览</a>
ASP生成静态页面的方法(5)  ASP生成静态页面的方法(5)2006-4-25 18:05:47ASP生成静态页面的方法(5)2006-4-25 18:05:47ASP生成静态页面的方法(5)
|
处理 SSI 文件时出错
|
版权与免责声明:① 本网转载其他媒体稿件是为传播更多的信息,此类稿件不代表本网观点,版权归原作者所有,本网不承担此类稿件侵权行为的连带责任。
② 本站原创文章,转载时请注明出自文谷及作者姓名
③在本网 BBS上发表言论者,文责自负。
④如您因版权等问题需要与本网联络,请在30日内联系 。
ASP生成静态页面的方法(5)  ASP生成静态页面的方法(5)2006-4-25 18:05:47ASP生成静态页面的方法(5)2006-4-25 18:05:47ASP生成静态页面的方法(5)
ASP生成静态页面的方法(5)  ASP生成静态页面的方法(5)2006-4-25 18:05:47ASP生成静态页面的方法(5)2006-4-25 18:05:47ASP生成静态页面的方法(5)
|