用了getrows提高效率
复制代码代码如下:
%
Response.Charset="GB2312"
Response.ContentType="text/xml"
Response.Expires=60
Response.Write("?xmlversion=""1.0""encoding=""GB2312""?")
response.write("?xml-stylesheettype=""text/css""href=""images/rss.css""?")
dimRssId,sql,rs,tid,rs_type,sql_type,sqqq,rsshow,thetitle,themon,theday,thedate,theyear
RssId=CheckStr(Request.QueryString("RSSID"))
ifnotIsInteger(RssId)thenRssId=1
'得到子类别的所有id
setrsshow=conn.execute("selecttname,counts,tidfrominfotypewhereid="RSSID"")
ifnot(rsshow.eofandrsshow.bof)then
thetitle=split(rsshow("tname"),"|")(rsshow("counts")-1)
tid=rsshow("tid")
endif
rsshow.close
setrsshow=nothing
setrs_type=server.CreateObject("ADODB.RecordSet")
sql_type="selectidfrominfotypewheretidlike'"tid"%'"
rs_type.opensql_type,conn,1,1
dowhilenotrs_type.EOF
sqqq=sqqqrs_type("id")","
rs_type.MoveNext
loop
rs_type.close
setrs_type=nothing
ifsqqq=""thensqqq=tid
sql="selecttop20type_id,title,id,content,datetime,authorfromnewswheretype_idin("sqqq")andisshow=trueorderbydatetimedesc,iddesc"
setrs=conn.execute(sql)
ifrs.eoforrs.bofthen
redimfeedcat(0,0)
else
feedrows=rs.getrows()
endif
rs.close
setrs=nothing
conn.close
setconn=nothing
%
rssversion="2.0"
channel
title![CDATA[%=thetitle%-本站-www.jb51.net]]/title
linkhttps://www.j***b51.net/link
description![CDATA[本站,努力提供没有错误的脚本,网络编程]]/description
languagezh-cn/language
copyright![CDATA[Copyright2006jb51]]/copyright
webMaster![CDATA[douxy001@gmail.com]]/webMaster
generatorjb512006/generator
%
ifubound(FeedRows,1)=0then
Response.Write("item/item")
else
fori=0toubound(FeedRows,2)
thedate=feedrows(4,i)
theyear=year(thedate)
themon=month(thedate)
iflen(themon)2thenthemon="0"themon
theday=theyearthemon
%
item
link%=siteurl%/html/%=theday%/%=FeedRows(2,i)%.htm/link
title![CDATA[%=FeedRows(1,i)%]]/title
author%=FeedRows(5,i)%/author
%
IFFeedRows(3,i)""andnotisnull(FeedRows(3,i))then
Response.Write("description![CDATA["ubbcode(left(FeedRows(3,i),500))"]]/description")
endif
%
pubDate%=FeedRows(4,i)%/pubDate
/item
%
next
endif
%
/channel
/rss
复制代码代码如下:
%
Response.Charset="GB2312"
Response.ContentType="text/xml"
Response.Expires=60
Response.Write("?xmlversion=""1.0""encoding=""GB2312""?")
response.write("?xml-stylesheettype=""text/css""href=""images/rss.css""?")
dimRssId,sql,rs,tid,rs_type,sql_type,sqqq,rsshow,thetitle,themon,theday,thedate,theyear
RssId=CheckStr(Request.QueryString("RSSID"))
ifnotIsInteger(RssId)thenRssId=1
'得到子类别的所有id
setrsshow=conn.execute("selecttname,counts,tidfrominfotypewhereid="RSSID"")
ifnot(rsshow.eofandrsshow.bof)then
thetitle=split(rsshow("tname"),"|")(rsshow("counts")-1)
tid=rsshow("tid")
endif
rsshow.close
setrsshow=nothing
setrs_type=server.CreateObject("ADODB.RecordSet")
sql_type="selectidfrominfotypewheretidlike'"tid"%'"
rs_type.opensql_type,conn,1,1
dowhilenotrs_type.EOF
sqqq=sqqqrs_type("id")","
rs_type.MoveNext
loop
rs_type.close
setrs_type=nothing
ifsqqq=""thensqqq=tid
sql="selecttop20type_id,title,id,content,datetime,authorfromnewswheretype_idin("sqqq")andisshow=trueorderbydatetimedesc,iddesc"
setrs=conn.execute(sql)
ifrs.eoforrs.bofthen
redimfeedcat(0,0)
else
feedrows=rs.getrows()
endif
rs.close
setrs=nothing
conn.close
setconn=nothing
%
rssversion="2.0"
channel
title![CDATA[%=thetitle%-本站-www.jb51.net]]/title
linkhttps://www.j***b51.net/link
description![CDATA[本站,努力提供没有错误的脚本,网络编程]]/description
languagezh-cn/language
copyright![CDATA[Copyright2006jb51]]/copyright
webMaster![CDATA[douxy001@gmail.com]]/webMaster
generatorjb512006/generator
%
ifubound(FeedRows,1)=0then
Response.Write("item/item")
else
fori=0toubound(FeedRows,2)
thedate=feedrows(4,i)
theyear=year(thedate)
themon=month(thedate)
iflen(themon)2thenthemon="0"themon
theday=theyearthemon
%
item
link%=siteurl%/html/%=theday%/%=FeedRows(2,i)%.htm/link
title![CDATA[%=FeedRows(1,i)%]]/title
author%=FeedRows(5,i)%/author
%
IFFeedRows(3,i)""andnotisnull(FeedRows(3,i))then
Response.Write("description![CDATA["ubbcode(left(FeedRows(3,i),500))"]]/description")
endif
%
pubDate%=FeedRows(4,i)%/pubDate
/item
%
next
endif
%
/channel
/rss