Friends who have seen can help the top. These code are sent for the first time. Many outside or out of the outside are very complicated. If you do n’t understand, or you ca n’t use it, I ’m as simple as possible when I write.
Add the RSS aggregation function for your website, blog, etc., and now give the polymerization code of RSS.ASP to see how you respond, if good
It is convenient for you to debug and show the appearance of http://www.nbpda.com/rss.asp
After testing, support most aggregate readers
The following code is saved as RSS.ASP
The following is the code fragment:
The following is the code fragment: <!-#Include file = "conn.asp "-> <% strurl = "http: //" & request.servervariables ("server_name") & _ Left (request.servervariables ("script_name"), Len (Request.servervariables ("Script_name"))-len ("/rss.asp") // is your name for your file name SQL = "Select Top 100 * From [Table Name] Order by ID DESC" // According to the actual modification, TOP 100 is the latest 100 items, modify it yourself, and at the same time you can add query conditions, such as where xxx = 1 .... set rs = server.createObject ("Adodb.oldSet") RS.Oopen SQL, CONN, 1,1 response.contenttype = "text/xml" response.write "<? Xml Version =" "1.0" "Encoding =" GB2312 ""?> "& VBCRLF response.write "<rss version =" "2.0" ""> "& vBCRLF response.write "<channel>" & vbcrf response.write "<Title> xxx.com RSS Feed </title>" & vBCRLF response.write "<link>" & Strurl & "</link>" & vbcrip response.write "<Language> ZH-CN </Language>" & VBCRLF response.write "<copyright> an rss feed for xxx.comcopyright>" & vBCRLF While Not RS.EOF response.write "<TEM>" & VBCRLF Response.write "<Title> <! [" "" & RS ("Title") & "]>> </Title>" & VBCRLF Response.write "<link>" & Strurl & "/xxxx.asp? ID =" & rs ("ID") & "</link>" & vblockff Response.write "<description> <! [" "" "" & rs ("theme field") & "<br />" & rs ("content field") & "<br /> <br />]> < /description> "& vbcrf Response.write "<pubdate>" & Return_rfc822_date (RS ("Time Field"), "GMT") & "</PUBDATE>" & VBCRLFFF response.write "</item>" & vbcrf rs.movenext wend response.write "</Channel>" & VBCRLF response.write "</rss>" & vBcrLF RS.Close set rs = Nothing Function return_rfc822_date (byval mydate, byval timezone) Dim myDay, myDays, mymonth, myyear Dim myHours, MyMinutes, MySeconds mydate = cdate (mydate) MyDay = EnweekDayName (mydate) MyDays = Right ("00" & Day (mydate), 2) myMONTH = ENMONTHNAME (mydate) myyear = year (mydate) myHOURS = Right ("00" & Hour (mydate), 2) Myminutes = Right ("00" & minute (mydate), 2) MySeconds = Right ("00" & Second (MyDate), 2) Return_rfc822_date = MyDay & "," & _ MyDays & "" & _ MyMONTH & "& _ Myyear & "" & _ myhouse & ":" & _ myminutes & ":" & _ MySeconds & "" & _ "" "& Timezone End function Function EnweekDayName (InputDate) Dim result Select Case WeekDay (Inputdate, 1) Case 1: Result = "Sun" Case 2: Result = "Mon" Case 3: Result = "Tue" Case 4: Result = "WED" Case 5: Result = "THU" Case 6: Result = "FRI" Case 7: Result = "SAT" End select EnweekdayName = result End function Function Enmonthname (InputDate) Dim result Select Case Month (inputDate) Case 1: Result = "Jan" Case 2: Result = "Feb" Case 3: Result = "Mar" Case 4: Result = "APR" Case 5: Result = "May" Case 6: result = "jun" Case 7: result = "jul" Case 8: Result = "Aug" Case 9: Result = "SEP" Case 10: Result = "Oct" Case 11: Result = "Nov" Case 12: Result = "DEC" End select Enmonthname = result End function %> |