Ver Mensaje Individual
  #28 (permalink)  
Antiguo 16/05/2007, 12:04
Avatar de sjam7
sjam7
 
Fecha de Ingreso: diciembre-2001
Ubicación: Guadalajara, Mexico
Mensajes: 3.672
Antigüedad: 22 años, 5 meses
Puntos: 16
Re: como hacer un RSS en ASP ???

un simple ejemplo:
Código:
<!--#include file="conexion.inc" -->

<%
'DSN-Less database connection
Query="SELECT * from notas ORDER by ID desc"
RS.Open Query,oConn,3

'XML OUTPUT

Dim fldF
Response.ContentType = "text/xml"
Response.Write "<?xml version=""1.0"" encoding=""iso-8859-1"" ?>" & vbCrlf
Response.Write "<rss version=""0.91"">" & vbCrlf
Response.Write "<channel>" & vbCrlf
Response.Write "<title>Ajalas.com</title>" & vbCrlf
Response.Write "<link>http://www.ajalas.com</link>" & vbCrlf
Response.Write "<description>Tu portal de internet</description>" & vbCrlf

'A loop to collect all the articles
do while not RS.EOF and cuenta<10

comentario=replace(rs("comentario"),"<br>",chr(13))
comentario=replace(comentario,">","&gt;")
comentario=replace(comentario,"<","&lt;")
comentario=replace(comentario,"&","&amp;")
'comentario=replace(comentario,"¿","&iquest;")
'comentario=replace(comentario,"'","&acute;")
'comentario=replace(comentario,"ñ","&Ntilde;")
'comentario=replace(comentario,"ñ","&ntilde;")
comentario=replace(comentario,"ó","&aacute;")
comentario=replace(comentario,"é","&eacute;")

comentario=replace(comentario,"á","&aacute;")
comentario=replace(comentario,"é","&eacute;")
comentario=replace(comentario,"í","&iacute;")
comentario=replace(comentario,"ó","&oacute;")
comentario=replace(comentario,"ú","&uacute;")

cuenta=cuenta+1

Response.Write "<item>" & vbCrlf         
Response.Write "<title>" & RS("titulo").Value & "</title>" & vbCrlf
Response.Write "<link>http://www.ajalas.com/noticias.asp?id="&rs("id")&"&amp;cat="&rs("categoria")&"</link>" & vbCrlf
Response.Write "<description>"  & vbCrlf
Response.Write "<![CDATA[" & vbCrlf
Response.Write comentario & "]]>" & vbCrlf
Response.Write "</description>" & vbCrlf
Response.Write "</item>" & vbCrlf   

 
RS.MoveNext
Loop
Response.Write "</channel>" & vbCrlf  
Response.Write "</rss>" & vbCrlf 
  
RS.Close
set RS = nothing
%>
El resultado lo puedes ver en www.ajalas.com/rss.asp
__________________
CreandoWebs.com
www.creandowebs.com
PLANTILLAS TEMPLATEMONSTER CON 10% DE DESCUENTO