示例地址:
http://www.18eden.com/rss.asp
站點:http://www.18eden.com/jiankang
該程序放根目錄
或者其他目錄,地址自己改,讀出最新的20條資源.( 可以修改成讀取get三數的形式)
自動判斷網站地址端口,無需要人工干預.
復制代碼 代碼如下:
<% Option explicit %>
<!--#include file="Manage/Include/Config.do" -->
<%
Dim sSQL, rs, sCrLf, sXmlClear, sRssHead, sRssEnd ,Url
sCrLf = chr(13) & chr(10) '回車+換行
If Request.ServerVariables("HTTPS") = "on" Then
URL = "https://"
Else
URL = "http://"
End If
Url=Url&Request.ServerVariables("SERVER_NAME")&":"&Request.ServerVariables("SERVER_PORT")
sXmlClear = "<?xml version='1.0' encoding='gb2312'?>" & sCrLf
'sRssHead ="<rdf:RDF xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#' xmlns:dc='http://purl.org/dc/elements/1.1/' xmlns:sy='http://purl.org/rss/1.0/modules/syndication/' xmlns:admin='http://webns.net/mvcb/' xmlns='http://purl.org/rss/1.0/'>"
sRssHead = "<rss version='2.0'>" & sCrLf
sRssHead = sRssHead & "<channel>" & sCrLf
sRssHead = sRssHead & "<title> "& Def_MySiteTitle &" </title>" & sCrLf
sRssHead = sRssHead & "<description> "& Def_SysTitle &" </description>" & sCrLf
sRssHead = sRssHead & "<link>" & url& "</link>" & sCrLf
sRssHead = sRssHead & "<language>zh-cn</language>" & sCrLf
sRssHead = sRssHead & "<docs>News Center</docs>" & sCrLf
'sRssHead = sRssHead & "<dc:creator>Yezhan,
[email protected]</dc:creator>" & sCrLf
sRssHead = sRssHead & "<generator>Rss Generator</generator><items>" & sCrLf
sRssEnd = "</items></channel></rss>"
'Response.CharSet="gb2312" '數據集
Response.ContentType="text/xml" '數據流格式定義
Response.ContentType="application/xml"
Response.Expires=0
Response.write sXmlClear
Response.write sRssHead
Dim Conn
Set Conn = Server.CreateObject("Adodb.Connection")
Conn.Open ConnStr
Dim sql
Sql="select Top "& RssNewsList_PageSize &" Title,FilePath,AddTime,KeyWord,Content,Classtitle,EditorTitle From view_NewsInfo where Del=0 Order By addTime DESC"
Set Rs=Server.CreateObject("ADODB.RecordSet")
Rs.open sql,conn,1,2
IF RS.EOF AND RS.BOF Then
Response.Write("<item></item>")
Else
do while not rs.eof
Response.Write("<item>")&RS("Title")
Response.Write("<title><![CDATA["&Rs("Title")&"]]></title>")
Response.Write("<description><![CDATA["&RS("KeyWord")&"]]>")
Response.Write("<content><![CDATA["&RS("Content")&"]]></content>")
Response.Write("<link>" &url&RS("FilePath")&"</link>")
Response.Write("<subject>"&RS("Classtitle")&"</subject>")
Response.Write("<creator>"&RS("EditorTitle")&"</creator>")
Response.Write("<date>"&RS("addtime")&"</date>")
Response.Write("</description></item>")
RS.MoveNext
loop
end if
rs.close
set rs=nothing
Response.write sRssEnd
%>
陸續放出少年不在修改版 tsys修改辦法```
http://www.im286.com/thread-1370996-1-1.html