分享

为动态网站制作RSS内容输出的程序模版

 非常主体 2006-10-29
<?xml version="1.0" encoding="gb2312"?>
<%
dim url,db,dbpath,conn,show_username
dim rs,SQL
db="data/oblog221.mdb" ‘这里修改数据库路径或名称
Set conn = Server.CreateObject("ADODB.Connection")
dbpath="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath(db)
conn.Open dbpath
%>
<rss VERSION="2.0">
 <channel>
  <TITLE>网站或栏目的名称</TITLE>
  <LINK>网站或栏目的URL地址</LINK>
  <description>网站或栏目的简要介绍</description>
<%
show_username=replace(request.QueryString("name"),"‘","")
‘set rs = Server.CreateObject("ADODB.Recordset")
if show_username<>"" then
 SQL="select top 10 * from blog where username=‘"&show_username&"‘ and ishide<>‘true‘ and passcheck<>‘false‘ and isnull(ispassword)=true and (isnull(blog_password)=true or blog_password=‘‘) order by id desc"
else
 SQL = "Select top 10 * from blog where ishide<>‘true‘ and passcheck<>‘false‘ and isnull(ispassword)=true and (isnull(blog_password)=true or blog_password=‘‘) order by id desc"
end if
set rs=conn.execute(SQL)
if rs.Eof or rs.Bof then
  response.write "<item></item>"
end if
while not rs.Eof
    response.Write "<item>"
 response.write "<link>"&url&"more.asp?name="&rs("username")&"&id="&rs("id")&"</link>"
 Response.write "<title><![CDATA["&rs("topic")&"]]></title>"
 response.write "<creator>"&rs("username")&"</creator>"
 response.write "<PubDate>"&rs("addtime")&"</PubDate>"
  response.write "<description><![CDATA["&rs("logtext")&"]]></description>"
 response.write "</item>"
 rs.MoveNext         
wend                 
set rs=nothing
conn.Close
set conn = nothing
%></channel></rss>

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多