Can be applied to the Max movie station to generate RSS Feed code _ Application Tips

Source: Internet
Author: User
Tags cdata chr
How to use: Save the following code as rss.asp (remember to save in UTF-8 format) and upload to the site root directory, the rest of the work is to find the RSS feed to submit the portal to submit your feed address http://your domain name/rss.asp
Demo: http://www.366mv.cn
Code as follows, please modify the appropriate information according to the comments, copyright information also hope you can retain ^_^

Copy Code code as follows:

<% @LANGUAGE = "VBSCRIPT" codepage= "65001"%>
<%
session.codepage=65001
response.charset= "UTF-8"
'========================================================================
' Copyright (c) 2005-2007, sour film ([Url]www.366mv.cn[/url]) All rights reserved.
'========================================================================
' Name: rss.asp
' Description: Generate RSS feeds dynamically.
'========================================================================
%>
<!--#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= "Sour film" ' changed to your own name
Response.Write "<channel>" &AMP;CHR (13)
Response.Write "<atom:link href=" "http://" &maxz_2& "/xml.asp" "rel=" "Self" "type=" "Application/rss+xml" " /> "&AMP;CHR (13)
Response.Write "<title> recently updated film-" &title& "</title>" &AMP;CHR (13)
Response.Write "<link>http://" &maxz_2& "</link>" &AMP;CHR (13)
Response.Write "<description>" &title& "-million movie online watch. Free movies, online movies, TVB, VCDs, Korean dramas, anime, sci-fi, horror, romance, serials, blockbusters, surreal ......</description> "&AMP;CHR (13)
Response.Write Get_left (15,0) ' shows top 15 movies, sorted by update date
Response.Write "</channel>" &AMP;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" ' Sort 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 as not rs1.eof
Get_left_i=get_left_i+1
get_left=get_left& "<item>" &AMP;CHR (13)
get_left=get_left& "<title>" &re (rs1 ("Zt_name")) & "</title>" &AMP;CHR (13)
get_left=get_left& "<link>http://" &maxz_2& "/" &get_classenname (Rs1 ("Zt_type")) & "/" &rs1 ("zt_id") & "</link>" &AMP;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> "&AMP;CHR (13)
get_left=get_left& "<guid>http://" &maxz_2& "/" &get_classenname (Rs1 ("Zt_type")) & "/" &rs1 ("zt_id") & "</guid>" &AMP;CHR (13)
get_left=get_left& "<category><! [cdata["&get_classname" (Rs1 ("Zt_type")) & "]]></category>" &AMP;CHR (13)
get_left=get_left& "<pubDate>" &datetorfc822 (rs1 ("Zt_date")) & "</pubDate>" &AMP;CHR (13)
get_left=get_left& "</item>" &AMP;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>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.