模板更新问题

papayo 2004-08-05 05:12:31
做个页面能在模板变更的条件下重新更新页面,使原来的数据换上新的模板
代码如下,写的代码出现的情况是将所有的数据都放在了同个页面上,请帮忙
说下我的代码哪里犯错了,谢谢


<%
Set artcle = conn.Execute ("SELECT * FROM N_artcle ORDER BY Artcle_id DESC")
%>
<%
do while not (artcle.eof)
%>
<%
assort_id=artcle("assort_id")
b1=artcle("Assort_id")
Set rs = conn.Execute ("SELECT * FROM N_assort where Assort_id=" & b1)
a1=rs("Assort_id")
a2=rs("assort_folder")
newsassort=""& a1 &","& a2 &""
artcle_link=artcle("artcle_link")
newstemplate=replace(artcle_link,right(artcle_link,19),"")
htmlfilename=right(artcle_link,18)
newskey=artcle("artcle_key")
newsfrom=artcle("artcle_from")
newssetup=artcle("artcle_setup")
author=artcle("artcle_author")
http=artcle("artcle_http")
Artcle_content=(artcle("Artcle_content"))
strTitle = trim(ChkString(artcle("artcle_title"),"save"))
strContent = (ChkString(Artcle_content,"save"))
assort=b1
folder=newstemplate
assort_id=replace(newsassort,Mid(newsassort,InstrRev(newsassort,",")),"")
newsassort1=Mid(newsassort,InstrRev(newsassort,",")+1)
newskey=trim(ChkString(newsky,"save"))
author=trim(ChkString(author,"save"))
newsfrom=trim(ChkString(newsfrom,"save"))


gblScriptName= Request.ServerVariables("Script_Name")
gblScriptName = Mid(gblScriptName,InstrRev(gblScriptName,"/") + 1)
folderPath=replace(Server.MapPath(Request.ServerVariables("Script_Name")),gblScriptName,"")
folderPath = replace(folderPath,Mid(folderPath,InstrRev(folderPath,"\")-9),"")

Set fso = CreateObject("Scripting.FileSystemObject")

Set objStream = fso.OpenTextFile(folderPath & "newstemplate\template\" & newstemplate & ".htm")

while not objStream.AtEndOfStream
newscontent= newscontent&objStream.ReadLine
newscontent=replace(newscontent,"{newstitle}",strTitle)
newscontent=replace(newscontent,"{newscontent}",strContent)
if author="" then
newscontent=replace(newscontent,"{author}","")
else
newscontent=replace(newscontent,"{author}","作者:" & author & "    ")
end if
if newsfrom="" then
newscontent=replace(newscontent,"{newsfrom}","")
else
newscontent=replace(newscontent,"{newsfrom}","新闻摘自:" & newsfrom & "    ")
end if
if Instr(newssetup,"2")>0 then
newscontent=replace(newscontent,"{newslink}","<script language=""javascript"" src=""../../newsweb/news_link.asp?assort=" & assort_id & "&keyword=" & ToUrl(newskey) & """></script>")
else
newscontent=replace(newscontent,"{newslink}","")
end if
newscontent=replace(newscontent,"{newsdate}","[新闻重新编辑于: " & Now() & "]")
wend
objStream.close
set objStream=nothing
if cint(assort_id)<>cint(assort) and folder<>newsassort1 then
if fso.FileExists(folderPath & "newshtml\" & folder & "\" & htmlfilename) then
set objFile=fso.GetFile(folderPath & "newshtml\" & folder & "\" & htmlfilename)
objFile.move folderPath & "newshtml\" & newsassort1 & "\" & htmlfilename
set objFile=nothing
Set objHtml = fso.OpenTextFile(folderPath & "newshtml\" & newsassort1 & "\" & htmlfilename,2)
else
htmlfilename=DateToFilename(Now())
Set objHtml = fso.CreateTextFile(folderPath & "newshtml\" & newsassort1 & "\" & htmlfilename)
end if
else
if fso.FileExists(folderPath & "newshtml\" & folder & "\" & htmlfilename) then
Set objHtml = fso.OpenTextFile(folderPath & "newshtml\" & newsassort1 & "\" & htmlfilename,2)
else
htmlfilename=DateToFilename(Now())
Set objHtml = fso.CreateTextFile(folderPath & "newshtml\" & newsassort1 & "\" & htmlfilename)
end if

end if

objHtml.WriteLine newscontent
objHtml.close
set objHtml=nothing
set fso=nothing
%>
<%
artcle.MoveNext
loop
%>
<%
artcle.close
set artcle=nothing
%>
...全文
32 点赞 收藏 回复
写回复
回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
相关推荐
发帖
ASP
创建于2007-09-28

2.8w+

社区成员

ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
申请成为版主
帖子事件
创建了帖子
2004-08-05 05:12
社区公告
暂无公告