Coder’s Stuff

20 Şubat 2008

Asp ile rss sayfası yapımı

Filed under: ASP — Etiketler:, , , — Berkay @ 18:07

Rss sayfası yapmanız için gereken kodlar aşağıdadır:


Asp ile RSS yapmanız için gereken kodlar:


<%
Set baglanti = Server.CreateObject("ADODB.Connection")
baglanti.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("database/db.mdb")

Response.Buffer = True
Response.ContentType = "text/xml"

Function Temizle(strInput)
strInput = Replace(strInput,"&", "&")
strInput = Replace(strInput,"'", "'")
strInput = Replace(strInput,"""", """)
strInput = Replace(strInput,">", ">")
strInput = Replace(strInput,"<","<")
strInput = Replace(strInput,"İ","I")
strInput = Replace(strInput,"Ş","S")
strInput = Replace(strInput,"Ü","U")
strInput = Replace(strInput,"Ö","O")
strInput = Replace(strInput,"Ç","C")
strInput = Replace(strInput,"Ğ","G")
strInput = Replace(strInput,"ğ","g")
strInput = Replace(strInput,"ı","i")
strInput = Replace(strInput,"ş","s")
strInput = Replace(strInput,"ü","u")
strInput = Replace(strInput,"ö","o")
strInput = Replace(strInput,"ç","c")
Temizle = strInput
End Function
%>

<rss version="2.0">
<channel>
<title>SİTENİZİN ADI</title>
<link>http://www.sitenizinadresi.com</link>
<description>En Son Eklenen 20 İçerik</description>
<language>tr</language>
<%
Set rs = Server.CreateObject("ADODB.Recordset")
SQL = "Select * from tablo_adi order by tarih desc"
rs.Open SQL,baglanti,1,3

i = 0
Do While i =< 19 And Not rs.Eof
Response.Write "<item>"
Response.Write "<title>" & Temizle(rs("icerik_adi")) & "</title>"
Response.Write "<link>http://www.sitenizinadresi.com/icerik.asp?id="& Temizle(rs("id")) &"</link>"
Response.Write "<description>İcerik Aciklamasi : " & Temizle(rs("icerik_aciklamasi")) & "</description>"
Response.Write "</item>"

i = i + 1
rs.MoveNext
Loop

rs.Close
%></channel></rss>

Yorum Yapılmamış »

Henüz yorum yapılmamış.

Bu yazıya yapılan yorumlar için RSS beslemeleri. TrackBack URL

Yorum yapın

Powered by WordPress

Yukarı çık