可以應(yīng)用到馬克斯電影站生成Rss Feed的代碼
更新時間:2008年03月18日 23:20:59 作者:
前段時間為了給本人的電影站增加Rss訂閱功能,動手寫了個動態(tài)生成Rss Feed的ASP代碼,沒法上傳附件,就直接貼代碼吧,反正也不長,用馬克斯做電影站的朋友直接拿去用吧,其它類型的站點(diǎn)修改一下也能用。生成的Rss Feed采用UTF-8編碼,經(jīng)過feedvalidator.org校驗,兼容Rss 2.0和Atom。
使用方法:將下面的代碼存為rss.asp(記得以UTF-8格式保存)并上傳到網(wǎng)站根目錄,剩下的工作就是找Rss提交入口去提交你的Feed地址http://你的域名/rss.asp
演示:http://www.366mv.cn
代碼如下,請根據(jù)注釋修改相應(yīng)的信息,版權(quán)信息還望各位能夠保留 ^_^
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<%
Session.CodePage=65001
Response.Charset="UTF-8"
'========================================================================
'Copyright (c) 2005-2007, 酸溜溜影視([url]www.366mv.cn[/url]) All rights reserved.
'========================================================================
'名稱: rss.asp
'描述: 動態(tài)生成Rss Feed。
'========================================================================
%>
<!--#include file=inc/conn.asp--><?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<%
title="酸溜溜影視" '改成你自己的名稱
response.write" <channel>"&chr(13)
response.write"<atom:link href=""http://"&maxz_2&"/xml.asp"" rel=""self"" type=""application/rss+xml"" />"&Chr(13)
response.write" <title>最近更新影片 - "&title&"</title>"&chr(13)
response.write" <link>http://"&maxz_2&"</link>"&Chr(13)
response.write" <description>"&title&" - 萬部影片在線觀看。免費(fèi)電影,在線電影,TVB,日劇,韓劇,動漫,科幻,恐怖,言情,連續(xù)劇,大片,賀歲片……</description>"&Chr(13)
response.write get_left(15,0) '顯示前15部影片,按更新日期排序
response.write" </channel>"&chr(13)
Function re(str)
If Not IsNull(str) then
re=Replace(str,"&","&")
re=Replace(re,"<","<")
re=Replace(re,">",">")
re=Replace(re,"'","'")
re=Replace(re,"""",""")
End if
End Function
Function get_left(n,m)
n=CInt(n):m=CInt(m)
If m=1 Then
mm=" order by zt_hits desc" '按點(diǎn)擊量排序
Else
mm=" order by zt_date desc" '按更新日期排序
End If
set rs1=conn.execute("select top "&n&" zt_id,zt_name,zt_zy,zt_dy,zt_type,zt_date,zt_hits,zt_content from zt_data"&mm)
get_left_i=0
Do while not rs1.eof
get_left_i=get_left_i+1
get_left=get_left&" <item>"&Chr(13)
get_left=get_left&" <title>"&re(rs1("zt_name"))&"</title>"&Chr(13)
get_left=get_left&" <link>http://"&maxz_2&"/"&get_classenname(rs1("zt_type"))&"/"&rs1("zt_id")&"</link>"&Chr(13)
get_left=get_left&" <description><![CDATA[<p>類別:<a href=""http://"&maxz_2&"/"&get_classenname(rs1("zt_type"))&""">"&get_classname(rs1("zt_type"))&"</a></p><p>主演:"&rs1("zt_zy")&"</p><p>劇情:"&re(rs1("zt_content"))&"</p>]]></description>"&Chr(13)
get_left=get_left&" <guid>http://"&maxz_2&"/"&get_classenname(rs1("zt_type"))&"/"&rs1("zt_id")&"</guid>"&Chr(13)
get_left=get_left&" <category><![CDATA["&get_classname(rs1("zt_type"))&"]]></category>"&Chr(13)
get_left=get_left&" <pubDate>"&DateToRFC822(rs1("zt_date"))&"</pubDate>"&Chr(13)
get_left=get_left&" </item>"&Chr(13)
If get_left_i>=n Then Exit Do
rs1.movenext
Loop
rs1.close
End Function
Function DateToRFC822(byVal dtaVal)
Dim strCurLocale : strCurLocale = GetLocale()
SetLocale("en-gb")
dtaVal = CDate(dtaVal)
DateToRFC822 = WeekdayName(Weekday(dtaVal),True)&", "& _
Right("0"&Day(dtaVal),2)&" "& _
MonthName(Month(dtaVal),True)&" "& _
Year(dtaVal)&" "& _
Right("0"&Hour(dtaVal),2)&":"& _
Right("0"&Minute(dtaVal),2)&":"& _
Right("0"&Second(dtaVal),2)&" "& _
Www~Chinaz~com
"+0800"
SetLocale(strCurLocale)
End Function
%></rss>
演示:http://www.366mv.cn
代碼如下,請根據(jù)注釋修改相應(yīng)的信息,版權(quán)信息還望各位能夠保留 ^_^
復(fù)制代碼 代碼如下:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<%
Session.CodePage=65001
Response.Charset="UTF-8"
'========================================================================
'Copyright (c) 2005-2007, 酸溜溜影視([url]www.366mv.cn[/url]) All rights reserved.
'========================================================================
'名稱: rss.asp
'描述: 動態(tài)生成Rss Feed。
'========================================================================
%>
<!--#include file=inc/conn.asp--><?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<%
title="酸溜溜影視" '改成你自己的名稱
response.write" <channel>"&chr(13)
response.write"<atom:link href=""http://"&maxz_2&"/xml.asp"" rel=""self"" type=""application/rss+xml"" />"&Chr(13)
response.write" <title>最近更新影片 - "&title&"</title>"&chr(13)
response.write" <link>http://"&maxz_2&"</link>"&Chr(13)
response.write" <description>"&title&" - 萬部影片在線觀看。免費(fèi)電影,在線電影,TVB,日劇,韓劇,動漫,科幻,恐怖,言情,連續(xù)劇,大片,賀歲片……</description>"&Chr(13)
response.write get_left(15,0) '顯示前15部影片,按更新日期排序
response.write" </channel>"&chr(13)
Function re(str)
If Not IsNull(str) then
re=Replace(str,"&","&")
re=Replace(re,"<","<")
re=Replace(re,">",">")
re=Replace(re,"'","'")
re=Replace(re,"""",""")
End if
End Function
Function get_left(n,m)
n=CInt(n):m=CInt(m)
If m=1 Then
mm=" order by zt_hits desc" '按點(diǎn)擊量排序
Else
mm=" order by zt_date desc" '按更新日期排序
End If
set rs1=conn.execute("select top "&n&" zt_id,zt_name,zt_zy,zt_dy,zt_type,zt_date,zt_hits,zt_content from zt_data"&mm)
get_left_i=0
Do while not rs1.eof
get_left_i=get_left_i+1
get_left=get_left&" <item>"&Chr(13)
get_left=get_left&" <title>"&re(rs1("zt_name"))&"</title>"&Chr(13)
get_left=get_left&" <link>http://"&maxz_2&"/"&get_classenname(rs1("zt_type"))&"/"&rs1("zt_id")&"</link>"&Chr(13)
get_left=get_left&" <description><![CDATA[<p>類別:<a href=""http://"&maxz_2&"/"&get_classenname(rs1("zt_type"))&""">"&get_classname(rs1("zt_type"))&"</a></p><p>主演:"&rs1("zt_zy")&"</p><p>劇情:"&re(rs1("zt_content"))&"</p>]]></description>"&Chr(13)
get_left=get_left&" <guid>http://"&maxz_2&"/"&get_classenname(rs1("zt_type"))&"/"&rs1("zt_id")&"</guid>"&Chr(13)
get_left=get_left&" <category><![CDATA["&get_classname(rs1("zt_type"))&"]]></category>"&Chr(13)
get_left=get_left&" <pubDate>"&DateToRFC822(rs1("zt_date"))&"</pubDate>"&Chr(13)
get_left=get_left&" </item>"&Chr(13)
If get_left_i>=n Then Exit Do
rs1.movenext
Loop
rs1.close
End Function
Function DateToRFC822(byVal dtaVal)
Dim strCurLocale : strCurLocale = GetLocale()
SetLocale("en-gb")
dtaVal = CDate(dtaVal)
DateToRFC822 = WeekdayName(Weekday(dtaVal),True)&", "& _
Right("0"&Day(dtaVal),2)&" "& _
MonthName(Month(dtaVal),True)&" "& _
Year(dtaVal)&" "& _
Right("0"&Hour(dtaVal),2)&":"& _
Right("0"&Minute(dtaVal),2)&":"& _
Right("0"&Second(dtaVal),2)&" "& _
Www~Chinaz~com
"+0800"
SetLocale(strCurLocale)
End Function
%></rss>
相關(guān)文章
ASP中字符與數(shù)字內(nèi)置操作函數(shù)整理
在ASP中,預(yù)定義了許多函數(shù),可以幫助我們簡化代碼、提高開發(fā)效率,本文將介紹一些常用的ASP字符與數(shù)字內(nèi)置操作函數(shù),以便開發(fā)人員更加方便、快速地創(chuàng)建 Web 應(yīng)用程序,2023-12-12在Z-BLOG可用的新版ASP的GIF驗證碼[V70404]
在Z-BLOG可用的新版ASP的GIF驗證碼[V70404]...2007-04-04ASP,vbs正則輪翻在文章段落后加上網(wǎng)址等內(nèi)容
ASP,vbs正則輪翻在文章段落后加上網(wǎng)址,網(wǎng)站名稱,網(wǎng)站介紹等內(nèi)容2008-06-06asp內(nèi)置對象 ObjectContext 事務(wù)管理 詳解
asp內(nèi)置對象 ObjectContext 事務(wù)管理 詳解...2007-11-11