Author |
Topic |
beznas
Starting Member
Morocco
23 Posts |
Posted - 19 March 2004 : 11:09:01
|
Can any one help:
I don't want to list the replies to each topic. I just want to list the newest 15 Topics without the replies.
Thank You.
|
Free Palestine! |
|
|
beznas
Starting Member
Morocco
23 Posts |
|
beznas
Starting Member
Morocco
23 Posts |
Posted - 20 March 2004 : 00:36:41
|
Ouf!
Finally, I spent all day and all night trying to figure it out and here it is:
This feed is customizable: You can choose the Forum and the number of messages you want to display
You can see it in action here
http://www.noukta.net/rss.asp?T=10
T=10 means that I want to display only 10 messages. It lists the topics and the first 150 characters of the messages.
<!--#INCLUDE FILE="config.asp" --> <!--#INCLUDE FILE="inc_func_common.asp" --> <!--#INCLUDE FILE="inc_func_secure.asp" -->
<% 'Choose the forum you want to display, I chose 4 here for my site xmlForum = 4
'This is how many messages they want to display dim strTop strTop = Request.Querystring ("T") If strTop = "" or strTop >50 then strTop = 25 End If
'These functions remove extra non-xml-friendly accents and punctuation in other languages such as French, ... Function CleanX(strString) Set regEx = New RegExp regEx.Pattern = "[^a-z0-9 ]+" regEx.IgnoreCase = True regEx.Global = True CleanX = regEx.Replace(strString, "") End Function
function SansAccents(text) olds = "éèàïêâôÉÈÀÏÊÂÔ<>!" news = "eeaieaoEEAIEAO---"
for i=1 to len(text) c=mid(text,i,1) n = instr(olds,c) if n>0 then c=mid(news,n,1) t = t & c next SansAccents = CleanX(t) end function
' End of Functions
'Now Let's get busy set my_Conn = Server.CreateObject("ADODB.Connection") my_Conn.Open strConnString
Set rs = Server.CreateObject("ADODB.Recordset")
sql = "SELECT TOP " & strTop & " * FROM " & strTablePrefix & "TOPICS WHERE FORUM_ID = " & xmlForum & " ORDER BY T_DATE DESC"
rs.Open sql, my_Conn rs.MoveFirst
xml = "" xml = "<?xml version=""1.0"" encoding=""ISO-8859-1"" ?>" xml = xml & "<!-- RSS generation done by Snitz Forums 2000 on " & chkDate(datetostr(strForumTimeAdjust)," ",true) & " --><rss version=""0.92""><channel>" 'Removal of the following line is illegal. Please give credit to the author. xml = xml & "<!-- Script Written By Anas Elhalabi, beznas@hotmail.com- -->" xml = xml & "<title>Active Topics on " & strForumTitle & "</title>" xml = xml & "<link>" & strForumURL & "</link>" xml = xml & "<description>" & strForumTitle & "</description>" xml = xml & "<copyright>Copyright 2004 Anas Elhalabi</copyright>" xml = xml & "<image>" xml = xml & "<link>" & strHomeURL & "</link>" xml = xml & "<url>" & strImageURL & "logo_powered_by.gif</url>" xml = xml & "<title>" & strForumTitle & " RSS Feed</title>" xml = xml & "<width>142</width>" xml = xml & "<height>23</height>" xml = xml & "</image>"
do while not rs.eof
TiD = rs("TOPIC_ID") strDescr = SansAccents(rs("T_MESSAGE")) strSubj = SansAccents(rs("T_SUBJECT"))
xml = xml & "<item>" xml = xml & "<title>" & strSubj & "</title>" xml = xml & "<link>" & "topic.asp?TOPIC_ID=" & TiD & "</link>" xml = xml & "<description>" & Left(strDescr,150) & " ...</description>" xml = xml & "</item>"
' move to the next record rs.movenext Loop
xml = xml & "</channel></rss>" Response.Clear Response.Expires = 0 Response.ContentType = "text/xml" Response.Write xml
my_Conn.close set my_Conn = nothing Response.End
%>
Enjoy |
Free Palestine! |
Edited by - beznas on 04 November 2004 01:44:34 |
|
|
hippojimj
Starting Member
USA
17 Posts |
|
hippojimj
Starting Member
USA
17 Posts |
Posted - 20 March 2004 : 12:32:45
|
Oops... found a little mistake... Line 77 needs to look like this for the links to work:
xml = xml & "<link>" & strForumURL & "topic.asp?TOPIC_ID=" & TiD & "</link>"
Thanks again! |
Jim Jones Co-Hippo Hippo Variety http://www.hippow.com http://www.auctionmanagement.net |
|
|
Comicozzi2
Starting Member
13 Posts |
Posted - 11 April 2004 : 11:28:12
|
I am using benzos mod and getting the following error...
ADODB.Recordset error '800a0bcd'
Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record.
/rssfeed.asp, line 83
Any thoughts?
I am a newbie so bear with me! |
|
|
beznas
Starting Member
Morocco
23 Posts |
Posted - 14 April 2004 : 10:13:07
|
try changing this
xmlForum = 4
to the number of your forum
That's the number of the forum you want to display. You can find that out by clicking on the forum in question from your main page, at the address bar you'll see forum.asp?FORUM_ID=X that's the number you want to enter in the xmlForum =
Let me know how you make out. |
Free Palestine! |
|
|
snowsurfer
New Member
64 Posts |
Posted - 19 May 2004 : 00:50:56
|
Okay I am so confused. How does this work. I want to show the name of the newest 5 topics with the time and date of the post. What is the XML stuff all about? |
|
|
i011877
Junior Member
Denmark
169 Posts |
Posted - 22 May 2004 : 06:19:18
|
I have not seen this in action yet! How does it look in real life? All i get is the code..bummer! |
|
|
|
beznas
Starting Member
Morocco
23 Posts |
Posted - 26 May 2004 : 12:50:57
|
If you want to 5 newest topics you do ...?T=5 |
Free Palestine! |
|
|
Comicozzi
Starting Member
49 Posts |
Posted - 14 July 2004 : 13:19:20
|
Consuming the code. I can output the code no problem. http://forums.sixgunner.com/rssfeed.asp
Now, my question is, how do I display the feed somewhere else. The juicystudio solution mentioned above is looking for a .xml but my output is: http://forums.sixgunner.com/rssfeed.asp
Doesn't anyone who want this file have to make the call to a .xml document?
I am getting the following error at: http://forums.sixgunner.com/displayrss.asp
----------------------------------- msxml3.dll error '800c0005'
The system cannot locate the resource specified.
/displayrss.asp, line 21 --------------------------------
which is: xmlHTTP.Send
Sorry I am bug but I am only a simple .asp developer.
Thanks for the help
|
|
|
yohan
Starting Member
12 Posts |
|
ukcw
Junior Member
121 Posts |
Posted - 06 August 2004 : 17:03:21
|
Hi all
I just placed the rssfeed.asp file into my forum directory and then wen to visit it at http://www.ukcc.jireh.org/forum/rssfeed.asp As you will see, I'm getting the following error: ADODB.Recordset.1 error '80004005'
SQLState: 42000 Native Error Code: 1064 [TCX][MyODBC]You have an error in your SQL syntax near '15 T.T_REPLIES, T.T_SUBJECT, T.TOPIC_ID, T.T_LAST_POST, T.T_LAST_POST_AUTHOR, T.' at line 1
/forum/rssfeed.asp, line 64
Shouldn't the page be displaying XML output? Anyone know what's going wrong, and what I need to do? Is it because I have loads of extra MODs installed?
Also, do I need to set up a custom rss.xsl document for this to work and the transformation function which appears in the header of my .asp page? I have no idea if I can use ones which have already been created somewhere...anyone any ideas? Thank you for your help :-) |
Edited by - ukcw on 06 August 2004 17:08:09 |
|
|
laser
Advanced Member
Australia
3859 Posts |
Posted - 06 August 2004 : 19:36:30
|
The page should display proper XML format, but I'd say that MySQL doesn't like the format of the sql statement passed to it. I doubt it has anything to do with your other mods, this is usually treated as a bolt-on and goes directly to your database.
Can you try this :
Just before line 64 add this :
Response.Write strSql
That won't fix your error, but it will expose your SQL statement.
Then you can try to change it from (something like) :
SELECT TOP 15 * FROM
to
SELECT * FROM mytable ORDER BY name ASC LIMIT 1, 15
But get your SQL statement first and go from there.
|
|
|
ukcw
Junior Member
121 Posts |
Posted - 07 August 2004 : 04:16:48
|
Hi Laser,
Have added the line as you requested - it's showing something, but it means nothing to me - could you take another look in case it helps you know what the problem is?
http://www.ukcc.jireh.org/forum/rssfeed.asp
Cheers |
|
|
Topic |
|