<%
class cls_CBRSS_Item
public Title
public Link
public Comments
public Description
public PubDate
end class
class cls_CBRSS
public Name
public Link
public Description
public PubDate
public GMT
public Encoding
public Language
public Items
private function rfc822date(d)
dim sWeekDay
dim sMonth
select case Weekday(d)
case 2 sWeekday = "Mon"
case 3 sWeekday = "Tue"
case 4 sWeekday = "Wed"
case 5 sWeekday = "Thu"
case 6 sWeekday = "Fri"
case 7 sWeekday = "Sat"
case else sWeekday = "Sun"
end select
select case Month(d)
case 1 sMonth = "Jan"
case 2 sMonth = "Feb"
case 3 sMonth = "Mar"
case 4 sMonth = "Apr"
case 5 sMonth = "May"
case 6 sMonth = "Jun"
case 7 sMonth = "Jul"
case 8 sMonth = "Aug"
case 9 sMonth = "Sep"
case 10 sMonth = "Oct"
case 11 sMonth = "Nov"
case else sMonth = "Dec"
end select
rfc822date = _
sWeekDay & ", " & _
Right(string(2,"0") & Day(d),2) & " " & _
sMonth & " " & Year(d) & " " & _
Right(string(2,"0") & Hour(d),2) & ":" & _
Right(string(2,"0") & Minute(d),2) & ":" & _
Right(string(2,"0") & Second(d),2) & " " & _
GMT
end function
public sub RenderRSS
Response.Clear
Response.ContentType = "text/xml"
Call Response.AddHeader("Content-Disposition", "filename=""rss.xml""")
Response.Write("" & vbCrLf)
Response.Write("" & vbCrLf)
Response.Write("" & vbCrLf)
Response.Write("" & name & " RSS Feed " & vbCrLf)
Response.Write("" & Link & "" & vbCrLf)
Response.Write("" & Description & " " & vbCrLf)
Response.Write("" & Language & " " & vbCrLf)
Response.Write("" & rfc822date(Now()) & " " & vbCrLf)
dim Item
for each Item in Items
set Item = Items(Item)
Response.Write("- " & vbCrLf)
Response.Write("" & Item.Title & " " & vbCrLf)
Response.Write("" & Item.Link & "" & vbCrLf)
if(Item.Comments <> "") then
Response.Write("" & Item.Comments & " " & vbCrLf)
end if
Response.Write(" " & vbCrLf)
Response.Write("" & rfc822date(Item.PubDate) & " " & vbCrLf)
Response.Write(" " & vbCrLf)
next
Response.Write(" " & vbCrLf)
Response.Write(" ")
end sub
public sub AddItem(oItem)
call Items.Add(oItem.Title, oItem)
end sub
public function NewItem
set NewItem = new cls_CBRSS_Item
end function
sub Class_Initialize
set Items = createObject("Scripting.Dictionary")
GMT = "+0000"
Encoding = "windows-1254"
Language = "tr"
end sub
sub Class_Terminate
set Items = nothing
end sub
end class
%>
<%
set oRSS = new cls_CBRSS
oRSS.Name = ""&site_title&""
oRSS.Link = ""&site_url&""
oRSS.Description =""&s_description&""
oRSS.GMT = "24H"
On Error Resume Next
Set rs = Server.createObject("ADODB.Recordset")
SQL = "Select top 10 id,baslik,ozet,tarih from tbl order by id desc"
rs.Open sql,conn,3,3
Response.Buffer = True
Do while Not Rs.EOF
set oItem = oRSS.NewItem
oItem.Title = rs("baslik")
oItem.Link = site_url&"/"&"konu.asp?sid="&rs("id")&""&"&"&""&lcase(cevir(rs("baslik")))&""&".html"
oItem.Description = kes(rs("ozet"),157)
oItem.PubDate = rs("tarih")
oRSS.AddItem(oItem)
Rs.MoveNext
Loop
Rs.Close
Set Rs = Nothing
oRSS.RenderRSS
Set oRSS = nothing
Response.End
%>
Ek Olarak: