Saturday, October 31, 2009

Recipe For Fondant On Cake Boss

Generate ASP ASP using RSS and BD

Many of us have needed or wanted to create RSS feeds with the content of our sites, the truth is easier than it seems, of course, after reading and researching I realized this, I intend to share here as
the

First we create the RSS file that can even have the ASP extension, for example rss.asp and paste something like this: \u0026lt;!--# include file = "conexion.inc" -> , \u0026lt;% 'FILE WITH THE CONNECTION BD%>

\u0026lt;%
' DSN-Less connection
database Query = "SELECT * from table

ORDER by ID desc" 'CREATE THE QUERY rs.Open Query, connection, 1.1' OPEN THE QUERY
'
XML OUTPUT' HERE WE CREATE THE NECESSARY XML GIVING OUT THE FORM AND HEAD

fldF
Dim Response. ContentType = "text / xml" Response.Write
"\u0026lt;? xml version =" 1.0 "encoding =" iso-8859-1 "?>" & vbCrLf Response.Write
\u0026lt;rss version = "" 2.0 "xmlns: dc =" http://purl.org/dc/elements/1.1/ "xmlns: content =" "http://purl.org/rss/1.0/modules/content/ ""> "& vbCrLf Response.Write
" \u0026lt;channel> "
& vbCrLf Response.Write "\u0026lt;title> TITLE \u0026lt;/ title>" & vbCrLf Response.Write
"\u0026lt;link> http://www.TUWEB.com \u0026lt;/ link>" & vbCrLf
Response. Write "\u0026lt;description> DESCRIPTION \u0026lt;/ description>" & vbCrLf Response.Write
"\u0026lt;language> en \u0026lt;/ language>" & vbCrLf



'A loop to collect all the articles Do While Not < rs.EOF and has 10 'LIMITED TO 10 THE DEPLOYMENT, USE IF YOU DO FROM THE MYSQL QUERY TO LIMIT

'REPLACES ONE PLACE TO CLEAR FIELD CONTENT


comment = replace (comment, "á", "á)
comment = replace (comment," é "," é)
comment = replace (comment, "t", "í)
comment = replace (comment," or "," ó)
comment = replace (comment, "ú", "& desktop search; ")

count = count +1

Response.Write" \u0026lt;item> "& vbCrLf
Response.Write "\u0026lt;title>" & RS ("title") & "\u0026lt;/ title>" & vbCrLf Response.Write
"\u0026lt;link> http://www.TUWEB.com/articulos . asp? id = "& rs (" id ")&"\u0026lt;/ link> "& vbCrLf Response.Write
" \u0026lt;description> "& vbCrlf
Response.Write" \u0026lt;! [ CDATA ["& vbCrLf Response.Write
comment & & "]]>" vbCrlf
Response.Write" \u0026lt;/ description> "& vbCrLf Response.Write
"GUID> isPermaLink=""true""> http://www.TUWEB.com/articulos.asp?id =" & rs ("id ")&"\u0026lt;/ guid>" & vbCrLf
Response.Write "\u0026lt;/ item>" & vbCrLf

rs.MoveNext

Loop Response.Write "\u0026lt;/ channel>" & vbCrLf Response.Write
"\u0026lt;/ rss>" & vbCrLf


rs.Close Set rs = nothing
%>
And presto, that's the ASP file that we create, not if you need more explanation, if so, I welcome your comments.

Above is a small modification of the original

http://www.cristovivo.com/rss.asp

0 comments:

Post a Comment