打造自己的RSS

       今天用asp写了一个自己网站的RSS,写了两看asp程序,本以为写个rrs很容易结果破费周折,下面把我的rss的代码贴出来供大家修改使用

<%
Response.ContentType="text/xml"
dim db,dbpath,conn
dim rs,SQL
db="db/#flsjfd8ulfs.asp"'数据库地址
Set conn = Server.CreateObject("ADODB.Connection")
dbpath="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath(db)
conn.Open dbpath
%><?xml version="1.0" encoding="gb2312"?><rss version="2.0">
<channel>
<title>我的网站名称</title>
<link>http://www.myweb.com</link>
<description>网站描术</description>
<%
SQL="select top 10 * from news order by id desc"
set rs=conn.execute(SQL)
if rs.Eof or rs.Bof then
  response.write "<item></item>"
end if
while not rs.Eof
a=rs("title")
b=rs("author")
c=rs("times")
d=replace(replace(left(rs("content"),200),"<","&lt;"),">","&gt;")
    response.Write "<item>"
 response.write "<link>http://xyb.nuc.edu.cn/readnews.asp?id="&rs("id")&"</link>"
 Response.write "<title>"&a&"</title>"
 response.write "<creator>"&b&"</creator>"
 response.write "<PubDate>"&c&"</PubDate>"
  response.write "<description>"&d&"</description>"
 response.write "</item>"
 rs.MoveNext         
wend                 
set rs=nothing
conn.Close
set conn = nothing
%>
</channel></rss>


还有一些其它可选标签,大家可根据需要增减,具体RSS请在网上搜RSS规范查看

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值