- <%
- Set objconn= server.CreateObject("ADODB.connection")
- Set objrec=Server.CreateObject("ADODB.recordset")
- objconn.open "DSNNouvelles"
-
- SQL = "SELECT * FROM NOUVELLES ORDER BY DATENEWS DESC"
-
- objrec.ActiveConnection = objconn
- objrec.Source = SQL
- objrec.CursorType = 0
- objrec.CursorLocation = 2
- objrec.LockType = 3
- objrec.Open()
-
- if Not Objrec.eof Then
- Response.Charset = "UTF-8"
- response.ContentType = "text/xml"
- xml = "<?xml version=""1.0"" encoding=""UTF-8""?><rss version=""2.0""><channel>"
- xml = xml &"<title>Exemple de flux RSS en ASP</title>"
- xml = xml &"<link>http://www.aspfr.com</link>"
- xml = xml &"<description>Les dernières nouvelles</description>"
- xml = xml &"<managingEditor>adressemail@fournisseur.com</managingEditor>"
- xml = xml &"<language>fr</language>"
- xml = xml &"<generator>ASPFR</generator>"
- xml = xml &"<copyright>ASPFR</copyright>"
- xml = xml &"<webMaster>ASPFR Webmaster</webMaster>"
- While not Objrec.eof
- id = objrec("ID")
-
- titre = objrec("AUTEUR") &" - Nouvelle Du Site"
- news = trim(objrec("MESSAGE"))
- news = replace(news, "<BR>", "<BR/>")
- news = replace(news, "&", "&")
- news = replace(news, "<", "<")
- news = replace(news, ">", ">")
-
- xml = xml &"<item>"
- xml = xml &"<author>"& objrec("AUTEUR") &"</author>"
- xml = xml &"<title>"& titre &"</title>"
- xml = xml &"<link>http://VotreSiteWeb/VotrePagedeLecture.asp?ValeurID="& id &"</link>"
- xml = xml &"<pubDate>"& objrec("DATENEWS") &" GMT</pubDate>"
- xml = xml &"<guid>http://VotreSiteWeb/VotrePagedeLecture.asp?ValeurID="& id &"</guid>"
- xml = xml &"<comments>http://VotreSiteWeb/VotrePagedeLecture.asp?ValeurID="& id &"</comments>"
- xml = xml &"<description>"
-
- xml = xml &" news
-
- xml = xml &"</description></item>"
- objrec.movenext
- Wend
-
- xml = xml &"</channel></rss>"
- Response.Write xml
- End If
- %>
<%
Set objconn= server.CreateObject("ADODB.connection")
Set objrec=Server.CreateObject("ADODB.recordset")
objconn.open "DSNNouvelles"
SQL = "SELECT * FROM NOUVELLES ORDER BY DATENEWS DESC"
objrec.ActiveConnection = objconn
objrec.Source = SQL
objrec.CursorType = 0
objrec.CursorLocation = 2
objrec.LockType = 3
objrec.Open()
if Not Objrec.eof Then
Response.Charset = "UTF-8"
response.ContentType = "text/xml"
xml = "<?xml version=""1.0"" encoding=""UTF-8""?><rss version=""2.0""><channel>"
xml = xml &"<title>Exemple de flux RSS en ASP</title>"
xml = xml &"<link>http://www.aspfr.com</link>"
xml = xml &"<description>Les dernières nouvelles</description>"
xml = xml &"<managingEditor>adressemail@fournisseur.com</managingEditor>"
xml = xml &"<language>fr</language>"
xml = xml &"<generator>ASPFR</generator>"
xml = xml &"<copyright>ASPFR</copyright>"
xml = xml &"<webMaster>ASPFR Webmaster</webMaster>"
While not Objrec.eof
id = objrec("ID")
titre = objrec("AUTEUR") &" - Nouvelle Du Site"
news = trim(objrec("MESSAGE"))
news = replace(news, "<BR>", "<BR/>")
news = replace(news, "&", "&")
news = replace(news, "<", "<")
news = replace(news, ">", ">")
xml = xml &"<item>"
xml = xml &"<author>"& objrec("AUTEUR") &"</author>"
xml = xml &"<title>"& titre &"</title>"
xml = xml &"<link>http://VotreSiteWeb/VotrePagedeLecture.asp?ValeurID="& id &"</link>"
xml = xml &"<pubDate>"& objrec("DATENEWS") &" GMT</pubDate>"
xml = xml &"<guid>http://VotreSiteWeb/VotrePagedeLecture.asp?ValeurID="& id &"</guid>"
xml = xml &"<comments>http://VotreSiteWeb/VotrePagedeLecture.asp?ValeurID="& id &"</comments>"
xml = xml &"<description>"
xml = xml &" news
xml = xml &"</description></item>"
objrec.movenext
Wend
xml = xml &"</channel></rss>"
Response.Write xml
End If
%>