Rss sayfası yapımı hakkında kısa bir çalışma...

Birçok websitesinde RSS sayfaları görmekteyiz. RSS, XML ismiyle de bilinmektedir. RSS genellikle haber ve download siteleri gibi sürekli güncellenen sitelerde kullanılmaktadır.

RSS ile sitemizde ki içeriğin, ziyaretçilerimiz tarafından yardımcı bir program kullanılarak sitemize girmesine gerek kalmadan okuyabilmelerini sağlayabiliriz. RSS sayfalarını okutmak için SharpReader adlı programı kullanabilirsiniz. Bununla birlikte, başka bir sitede yer alan RSS sayfasından ASP ile veri alıp sitemiz içerisinde yayınlayabiliriz.

Kendi sitemde kullandığım RSS sayfasının kodlarını sizlerle paylaşmak istiyorum.

Kod:

<%
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>https://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>https://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>

Yukarıda görmüş olduğunuz koddaki ilgili yerleri kendi sitenize göre düzenleyerek RSS sayfanızı oluşturabilirsiniz. RSS sayfası içerisinde, veritabanından gelen Türkçe harflerde yer alan noktaları replace yöntemi ile kaldırmaktayız.

RSS sayfasında, aşağıda yer alan hatayı alırsanız Türkçe karakterleri düzenleyerek bu hatayı giderebilirsiniz.

Kod:

"An invalid character was found in text content. Error processing resource"