Today, I want to write a dynamic leaf surface for the new website. In fact, I am not very professional, but "gentleman is good and false". I collected some information on the Internet.
Disadvantages: Since the function of this others does not define the format of FSO, it only supports GB2312 output. If you use UTF-8 output
Approximate process
1. Familiar with the RSS specification and format
If this simple is not easy to find a standard, you can open the RSS.XML aggregate source of others to see it.
2. Understand the process
Create an ASP (Creaters.asp)-> processing read data (SQL/Access, etc.)-> Write into RSS.XML-Success!
3. Preparation
This is a function created and written by a file written by others
write2file.asp
| The following is the code fragment: <% 'Wite2file.asp 'Write file Sub write2file (Strfile, StrContent, Blnappend) 'Strfile file name (path), the content written by StrContent, whether blnappend is added On error resume next Set objfso = server.createObject ("scripting.filesystemObject") If blNappend then Set objwriteText = Objfso.OpenTextFile (Strfile, 8, TRUE) Else Set objwriteText = Objfso.OpenTextFile (Strfile, 2, TRUE) End if objwritetext.writeline (Strcontent) Set objwriteText = Nothing Set objfso = nothing 'Fault tolerance treatment Select Case Err Case 424 response.write "The path" The path is not found or the directory is not written into permissions. " Case Else Response.write Err.Descripting 'Case Else Response.write ErRMSG End select End sub 'Call 'Write2file "c: /dd.ini", "dd", true 'Call writing2file ("c: /dd.ini", "dd", true) 'Can create files, but cannot create a directory %> |
setrss.asp
| The following is the code fragment: 'Createrss.asp <!-#include file = "write2file.asp"-> Dim myrss, ENTER ENTER = FALSE 'is used to determine whether myrss get valid data 'Define the RSS.XML header Myrss = "<? xml Version =" "1.0" "ENCODING =" GB2312 "" Standalone = "" YES "" "" "?> <rss Version =" "2.0" "xmlns: dc =" "http: // pURL. ORG/DC/Elements/1.1/"XMLNS: Trackback =" http://madskills.com/public/xml/rss/module/trackback/ "xmlns:" http://wellformedWe B.org/ Commentapi/""> <cannel> <Title> Webtitle </Title> <link> SITEHOST </link> <description> webdescripting </description> <General> Generator </Generator> <Language> zh-cn </laanguage> <copyright> 9xiao.cn </Copyright> <PUBDATE> PUBDATE </PUBDATE> " 'Read the data <TEEM> <...> 'Define the database connection in advance set rs = server.createObject ("Adodb.oldSet") sql = "select * from table" RS.Oopen SQL, CONN, 1, 1 if not rs.eof then ENTER = TRUE 'has content to insert RSS do while not rs.eof Myrss = Myrss & "<TEM> <Title>" & RS ("Title") & "</Title> <AUTHOR>" & RS ("Author") & "</author> <link> & rs (" "" Link ") &" </link> <PUBDATE> "& RS (" Pubdate ") &" </PUBDATE> <GUID> "& RS (" Link ") &" </Guid> <! [CDATA [& rs ("yourcontent") & "]]> </description> <category>" & rs ("category") & "</category> </item>" "" " rs.movenext loop end if RS.Close set rs = Nothing 'RSS end Please replace the content in your own field in 'rs ("******") 'End rss.xml Myrss = Myrss & "</Channel> </RSS>" " 'Write into RSS if Enter = true then Write2File Server.mappath ("RSS.XML"), Myrss, FALSE ' end if %> |