Merhaba arkadaşlar,
Asp.NET fazla geldiğinden .NET’i çıkarıp sade ASP ile ilgili güzel bir ders anlatmak istiyorum. Çoğu sitede 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.
Aşağıda görmüş olduğunuz kodlarda ki 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 onuda unutmadan söyleyelim ve kodlarımıza geçelim;
1 <% 2 Set baglanti = Server.CreateObject("ADODB.Connection") 3 baglanti.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("database/db.mdb") 4 5 Response.Buffer = True 6 Response.ContentType = "text/xml" 7 8 Function Temizle(strInput) 9 strInput = Replace(strInput,"&", "&") 10 strInput = Replace(strInput,"'", "'") 11 strInput = Replace(strInput,"""", """) 12 strInput = Replace(strInput,">", ">") 13 strInput = Replace(strInput,"<","<") 14 strInput = Replace(strInput,"İ","I") 15 strInput = Replace(strInput,"Ş","S") 16 strInput = Replace(strInput,"Ü","U") 17 strInput = Replace(strInput,"Ö","O") 18 strInput = Replace(strInput,"Ç","C") 19 strInput = Replace(strInput,"Ã","G") 20 strInput = Replace(strInput,"ğ","g") 21 strInput = Replace(strInput,"ı","i") 22 strInput = Replace(strInput,"ş","s") 23 strInput = Replace(strInput,"ü","u") 24 strInput = Replace(strInput,"ö","o") 25 strInput = Replace(strInput,"ç","c") 26 27 Temizle = strInput 28 End Function 29 %> 30 31 <rss version="2.0"> 32 <channel> 33 <title>SİTENİZİN ADI</title> 34 <link>http://www.sitenizinadresi.com</link> 35 <description>En Son Eklenen 20 İçerik</description> 36 <language>tr</language> 37 <% 38 Set rs = Server.CreateObject("ADODB.Recordset") 39 SQL = "Select * from tablo_adi order by tarih desc" 40 rs.Open SQL,baglanti,1,3 41 42 i = 0 43 Do While i =< 19 And Not rs.Eof 44 Response.Write "<item>" 45 Response.Write "<title>" & Temizle(rs("icerik_adi")) & "</title>" 46 Response.Write "<link>http://www.sitenizinadresi.com/icerik.asp?id= "& Temizle(rs("id")) &"</link>" 47 Response.Write "<description>İcerik Aciklamasi : " & Temizle(rs("icerik_aciklamasi")) & "</description>" 48 Response.Write "</item>" 49 50 i = i + 1 51 rs.MoveNext 52 Loop 53 54 rs.Close 55 %></channel></rss>
- emresupcin
- Asp.Net
- 20 Ekim 2013 - 17:57
- Yorum Yok
- 1140 Görüntülenme
ado db asp asp data asp fonksiyonları asp kodları asp ödevleri asp projeleri asp rss asp rss oluşturma asp stro fonksiyonları asp veri tabanı strinput