rss2.asp
来自「是个不错的文件代码,希望大家好好用,」· ASP 代码 · 共 77 行
ASP
77 行
<!--#include file="conn.asp"-->
<!--#include file="inc/class_sys.asp"-->
<%dim oblog
set oblog=new class_sys
oblog.autoupdate=false
oblog.start
Response.contentType="application/xml"
Response.Expires=0
Response.Write "<?xml version=""1.0"" encoding=""GB2312""?>"
%>
<?xml-stylesheet type="text/css" href="oblogstyle/rss.css"?>
<rss version="2.0">
<channel>
<title><%=FmtStringForXML(oblog.CacheConfig(1))%></title>
<link><%=oblog.CacheConfig(3)%></link>
<description><%=oblog.CacheConfig(5)%></description>
<generator>Oblog 4.0</generator>
<webMaster><%=oblog.CacheConfig(11)%></webMaster>
<%
dim rs,sql,classid,logtext
classid=clng(request("classid"))
if classid>0 then
sql=" and classid="&classid
else
sql=""
end if
set rs=oblog.execute("select top 12 * from oblog_log where ishide=0 and passcheck=1 and isdraft=0 and blog_password=0"&sql&" order by logid desc")
if rs.Eof or rs.Bof then
response.write "<item></item>"
end if
while not rs.Eof
if rs("ispassword")="" or isnull(rs("ispassword")) then
logtext=oblog.trueurl(rs("logtext"))
else
logtext="此日志内容已加密"
end if
if rs("ishide")=1 then logtext="此日志内容已隐藏"
response.Write "<item>" & vbcrlf
Response.write "<title><![CDATA["&rs("topic")&"]]></title>" & vbcrlf
if true_domain=0 then
response.write "<link>"&oblog.CacheConfig(3)&rs("logfile")&"</link>" & vbcrlf
else
response.write "<link>"&rs("logfile")&"</link>" & vbcrlf
end if
response.write "<author>"&rs("author")&"</author>" & vbcrlf
response.write "<pubDate>"&rs("addtime")&"</pubDate>" & vbcrlf
response.write "<description><![CDATA["&logtext&"]]></description>" & vbcrlf
response.write "</item>"
rs.MoveNext
wend
set rs=nothing
%>
</channel>
</rss>
<%
Function FmtStringForXML(byval sContent)
Dim objRegExp,strOutput
If IsNull(sContent) Then
FmtStringForXML=""
Exit Function
End If
strOutput=Trim(sContent)
If Instr(strOutput,"<") And Instr(strOutput,">") Then
'剔除<>标记
Set objRegExp = New Regexp
objRegExp.IgnoreCase = True
objRegExp.Global = True
objRegExp.Pattern = "<.+?>"
strOutput = objRegExp.Replace(strOutput, "")
Set objRegExp = Nothing
End If
strOutput=Replace(strOutput," ","")
strOutput=Replace(strOutput,"<>","")
strOutput=Replace(strOutput," "," ")
FmtStringForXML = strOutput
End Function
%>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?