Recommended: 20 very useful examples in ASP programming (I) 1. How to use Asp to determine the virtual physical path of your website Answer: Use the Mappath method: < %= Server.MapPath()% >2. How do I know the browser used by the user? Answer: Use the Request object method:
Some time ago, in order to add Rss subscription function to my movie site, I wrote an ASP code that dynamically generates Rss Feed. I can't upload attachments, so I just pasted the code. It's not long anyway. Friends who use Max as movie site will get it directly. Go and use it, you can also use it if you modify other types of sites. The generated Rss feed is encoded by UTF-8, is verified by feedvalidator.org, and is compatible with Rss 2.0 and Atom.
How to use: Save the following code as rss.asp (remember to save it in UTF-8 format) and upload it to the website root directory. The rest is to find the Rss submission portal to submit your feed address http://your domain name /rss.asp
Demo: http://www.366mv.cn
The code is as follows. Please modify the corresponding information according to the comments. I hope you can retain the copyright information ^_^
| <%@LANGUAGE=VBSCRIPT CODEPAGE=65001%> <% Session.CodePage=65001 Response.Charset=UTF-8 '=================================================================== ================================ 'Copyright (c) 2005-2007, Sour Liu Liu Film and Television ([url]www.366mv.cn[/url]) All rights reserved. '=================================================================== ================================ 'Name: rss.asp 'Description: Dynamically generate 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=Souliao Liu Film and Television'Change it to your own name 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>Latest updated videos - &title&</title>&chr(13) response.write <link>http://&maxz_2&</link>&Chr(13) response.write <description>&title& - Watch ten thousand videos online. Free movies, online movies, TVB, Japanese dramas, Korean dramas, animation, science fiction, horror, romance, TV series, blockbusters, New Year's films...</description>&Chr(13) response.write get_left(15,0) 'Show the first 15 videos, sorted by update date 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 'Sorted by clicks Else mm= order by zt_date desc 'Sorted by update date 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>Category: <a href=http://&maxz_2&/&get_classenname(rs1(zt_type))&>&get_classname(rs1(zt_type))&</a></p ><p>Starring: &rs1(zt_zy)&</p><p>Plot: &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)& & _ 0800 SetLocale(strCurLocale) End Function %></rss> |
Share: How can ASP get the first image address in the code 'Modify the pattern again'code to detect the code'http://www.knowsky.com/asp.asp'leixing html or ubb'nopic code has no picture function toppic(code,leixing,nopic) set regex = ne