I always wanted to give users (well, myself!) a way to subscribe a Topic, Forum, Category, or All of the above RSS Feed, kinda like, if you are in a topic, you can subscribe the Feed for that topic, that topic's Forum, that category's Forum, and all of it.
So, this dawn I just did it and give to Marcel (www.oxle.com) as well because as I said before, I wanted this to my own
the code of the <b>rssFeed.asp</b> file
can be found here
and this is the code header:
Code:
' ##############################################################################################
' # RSS Snitz Multiple Feed
' ##############################################################################################
' ##############################################################################################
' # Coded by: Bruno Alexandre < bruno.in.dk [at] gmail.com >
' # Last Update date: Saturday, 7 August 2010
' #
' # This RSS Feed is valid to all Categories, Forums and Topcis, Specific Category,
' # specific Forum and Specific Topic
' # To use just pass the Cat_ID or Forum_ID or Topic_ID in the URL
' #
' # Examples:
' #
' # rssFeed.asp Default Mode: Shows all categories, forums, topics, replies
' # rssFeed.asp?Cat_ID=321 category Mode: Shows all forums, topics and replies for that Category
' # rssFeed.asp?Forum_ID=321 Forum Mode: Shows all topics, replies for that Forum
' # rssFeed.asp?Topic_ID=123 Topic Mode: Shows all replies for that Topic
' #
' # Usage:
' # Rename the file to rssFeed.asp
' #
' # <link rel="alternate" type="application/rss+xml" title="Fórum GAPE (All public)" href="http://www.mysnitzforum.com/rssFeed.asp" />
' # <link rel="alternate" type="application/rss+xml" title="Fórum GAPE (Category)" href="http://www.mysnitzforum.com/rssFeed.asp?url=category,123" />
' # <link rel="alternate" type="application/rss+xml" title="Fórum GAPE (Forum)" href="http://www.mysnitzforum.com/rssFeed.asp?url=forum,123" />
' # <link rel="alternate" type="application/rss+xml" title="Fórum GAPE (Topic)" href="http://www.mysnitzforum.com/rssFeed.asp?url=topic,123" />
' #
' # Replace 123 with the
' # Request.QueryString("Cat_ID")
' # Request.QueryString("Forum_ID")
' # Request.QueryString("Topic_ID")
' # according
' #
' ##############################################################################################
' ##############################################################################################
' # v.1.2 (07.Aug.2010): Added ability to not display replies (only Topics)
' # Changed encode to UTF-8, instead ISO-8859-1
' # v.1.1 (06.Dec.2008): Added Encode, Decode url parameters
' # Will show only public forums
' # v.1.0 (05.Dec.2008): Hello World!
' ##############################################################################################
to use this, all you need is to edit and add the LINK tag to the <b>inc_header.asp</b>
You can add the below code to inc_header.asp after the SNITZ FORUMS 2000 LICENSE AGREEMENT ending around line 230
Code:
' ###########################################################################
' # RSS Snitz Multiple Feed MOD by Bruno Alexandre
' # Snitz Topic in: http://forum.snitz.com/forum/topic.asp?TOPIC_ID=67930
' ###########################################################################
Dim feedType, feedAvailable, queryID, rssCategoryID, rssForumID
Dim rssTopicID, rssCategoryTitle, rssForumTitle, rssTopicTitle
rssCategoryID = ""
rssForumID = ""
rssTopicID = ""
rssCategoryTitle = ""
rssForumTitle = ""
rssTopicTitle = ""
feedAvailable = true
if Request.QueryString("cat_id") <> "" then
feedType = "category"
queryID = Request.QueryString("cat_id")
elseif Request.QueryString("forum_id") <> "" then
feedType = "forum"
queryID = Request.QueryString("forum_id")
elseif Request.QueryString("topic_id") <> "" then
feedType = "topic"
queryID = Request.QueryString("topic_id")
end if
if feedType <> "" then
strSql = ""
strSql = strSql & "SELECT "
if feedType = "category" or feedType = "forum" or feedType = "topic" then strSql = strSql & "c.CAT_ID, c.CAT_NAME, "
if feedType = "forum" or feedType = "topic" then strSql = strSql & "f.FORUM_ID, f.F_SUBJECT, "
if feedType = "topic" then strSql = strSql & "t.TOPIC_ID, t.T_SUBJECT, "
strSql = strSql & "f.F_PRIVATEFORUMS, "
strSql = Left(strSql, Len(strSql) - 2)
strSql = strSql & " FROM "
if feedType = "category" or feedType = "forum" or feedType = "topic" then strSql = strSql & "FORUM_CATEGORY AS c, "
if feedType = "forum" or feedType = "topic" then strSql = strSql & "FORUM_FORUM AS f, "
if feedType = "topic" then strSql = strSql & "FORUM_TOPICS AS t, "
if feedType = "category" then strSql = strSql & "FORUM_FORUM AS f, "
strSql = Left(strSQL, Len(strSql) - 2)
strSql = strSql & " WHERE "
if feedType = "category" then strSql = strSql & "f.CAT_ID = c.CAT_ID "
if feedType = "forum" or feedType = "topic" then strSql = strSql & "c.CAT_ID = f.CAT_ID "
if feedType = "topic" then strSql = strSql & "AND f.FORUM_ID = t.FORUM_ID "
strSql = strSql & "AND f.F_PRIVATEFORUMS = 0 "
if feedType = "category" then strSql = strSql & "AND c.CAT_ID = " & Request.QueryString("Cat_ID") & ";"
if feedType = "forum" then strSql = strSql & "AND f.FORUM_ID = " & Request.QueryString("Forum_ID") & ";"
if feedType = "topic" then strSql = strSql & "AND t.TOPIC_ID = " & Request.QueryString("Topic_ID") & ";"
set rs = Server.CreateObject("ADODB.Recordset")
rs.open strSql, my_Conn
if rs.EOF then
feedAvailable = false
else
if feedType = "category" or feedType = "forum" or feedType = "topic" then
rssCategoryID = rs("CAT_ID")
rssCategoryTitle = rs("CAT_NAME")
else
rssCategoryID = ""
rssCategoryTitle = ""
end if
if feedType = "forum" or feedType = "topic" then
rssForumID = rs("FORUM_ID")
rssForumTitle = rs("F_SUBJECT")
else
rssForumID = ""
end if
if feedType = "topic" then
rssTopicID = rs("TOPIC_ID")
rssTopicTitle = rs("T_SUBJECT")
else
rssTopicID = ""
rssTopicTitle = ""
end if
end if
rs.close
set rs = nothing
end if
Response.Write "<link rel=""alternate"" type=""application/rss+xml"" title=""" & strForumTitle & " (All public)"" href=""" & strForumURL & "/rssFeed.asp"" />"
if feedAvailable then
if isNumeric(rssCategoryID) Then Response.Write "<link rel=""alternate"" type=""application/rss+xml"" title=""" & strForumTitle & " (Category: " & rssCategoryTitle & ")"" href=""" & strForumURL & "/rssFeed.asp?url=" & Encode("category," & rssCategoryID) & """ />"
if isNumeric(rssForumID) Then Response.Write "<link rel=""alternate"" type=""application/rss+xml"" title=""" & strForumTitle & " (Forum: " & rssForumTitle & ")"" href=""" & strForumURL & "/rssFeed.asp?url=" & Encode("forum," & rssForumID) & """ />"
if isNumeric(rssTopicID) Then Response.Write "<link rel=""alternate"" type=""application/rss+xml"" title=""" & strForumTitle & " (Topic: " & rssTopicTitle & ")"" href=""" & strForumURL & "/rssFeed.asp?url=" & Encode("topic," & rssTopicID) & """ />"
end if
Function Encode(sIn)
dim x, y, abfrom, abto
Encode="": ABFrom = ""
For x = 0 To 25: ABFrom = ABFrom & Chr(65 + x): Next
For x = 0 To 25: ABFrom = ABFrom & Chr(97 + x): Next
For x = 0 To 9: ABFrom = ABFrom & CStr(x): Next
abto = Mid(abfrom, 14, Len(abfrom) - 13) & Left(abfrom, 13)
For x=1 to Len(sin): y = InStr(abfrom, Mid(sin, x, 1))
If y = 0 Then
Encode = Encode & Mid(sin, x, 1)
Else
Encode = Encode & Mid(abto, y, 1)
End If
Next
End Function
' # End RSS Snitz Multiple Feed MOD
' ###########################################################################
A <b><font color="red">live example</font id="red"></b> can be found here:
http://www.balexandre.com/sf2k_v34_06/
you can always just use it in the normal
RSS Feed way, just, this gives you much more options.
fell free to criticize