Snitz™ Forums 2000
https://forum.snitz.com/forumTopic/Posts/65954?pagenum=1
05 November 2025, 06:51
Topic
balexandre
MOD: Latest Top 10 Messages
26 November 2007, 01:49
continuing what I said in this topic about the "Show how many messages since yours" here is the Finished MOD that you can start use...
Code:
' ********************************************************************************************** ' Author: Bruno Alexandre <bruno [dot] in [dot] dk [at] gmail [dot] com> ' Date: April 2007 ' MOD: Get last 10 messages in the Forum ' Function: ' Displays vertically and horizontally the Top messages in the Forum ' it turns user own message in a different color ' Versions: ' 1.0 Original version ' 1.1 26.11.07 Added more string to the translate part ' Added Rows and Columns in order to display ' 1.2 01.03.08 Added block preventing private messages to show ' 1.3 02.03.08 Updated with TopSQL() so it runs in mySQL as well (>4.x) ' ' **********************************************************************************************
How to use it
It's really simple, the MOD will build a table with Rows and Columns that you can specified in the 2 variables, the TOP messages displayed will be the multiplication of those 2 values, so if you specify 2 rows by 5 cols you will get the Top 10 messages in the forum, if you select 4 rows by 5 cols you will get the Top 20 messages in the forum.
There are more variables that you can play with, and the right translation as well using the Session.LCID variable in ASP.
How to get itcheck it here to see the code save as inc_topMessages.asp and just place the include where you need it like
Code:
<!-- #include file="inc_topMessages.asp" -->
How can I test it
you have this direct link that, by default shows you 2 rows by 5 columns, to use with more variations, I changed the code so you can use the query to pass how many rows and how many columns you want to be displayed...
so, instead of http://ga-paneuropean.com/gape.v2/test_topMessages.asp you can add ?rows=4&cols=2 to be like http://ga-paneuropean.com/gape.v2/test_topMessages.asp?rows=4&cols=2 so it will show you 4 rows by 2 columns.
Hope you like the MOD.
Images so you can see what the mod does:
<
Replies ...
Etymon
26 November 2007, 16:04
Thank you very much, Bruno for sharing your code with us! Cheers,
Etymon <
balexandre
26 November 2007, 18:31
just updated...
complete MOD with Rows and Columns ... check the instructions in the Topic <
Target_Locked
06 December 2007, 02:22
Originally posted by balexandre just updated...
complete MOD with Rows and Columns ... check the instructions in the Topic
balexandre, Thanks for your sharing code.
Everything is good, however I would like to suggest: 1. Bring the "Topic name" to top of cell and use bigger font/Bold..., because this is the most important part.
2. Bring item "by User...date...time" to middle position, and use normal font size. Move "date...time" follow to the right of "User" to save a line.
3. Modify the topic link (Topic name) so that it will jump to the last page of the thread. Currently it just jump to the first page.
Thanks.<
balexandre
07 December 2007, 16:24
Target_Locked:
1. Topics kind to be really big, so I did not added as Big Text to save space, dont forget that this was originaly just for my forum and I use 10 rows by 1 columns
2. this is merelly layout, you can fix the code for that
3. I dont know if you saw it, but there is the same ICON that is used in the forum to jump to last message of the topic, the blue arrow... that one will jump to the last message while the topic name will jump to the first message of the topic, just like any topic in the forum, so you have both links
Etymon: always welcome <
richfed
29 February 2008, 14:36
What would need to be done in this code to prevent previews of posts in private and password protected forums from showing up in the table?
Thanks for any help!<
kolucoms6
29 February 2008, 14:40
Good Question !!!<
balexandre
01 March 2008, 14:38
hummm... I'm not familiarize with password protected forums, can you give me that MOD link so I can see what new columns does it add so I can provide you with the correct SQL Query for that?
thxs
<
richfed
01 March 2008, 15:42
Not a MOD, Bruno ... I believe it is in the base forum code.<
balexandre
01 March 2008, 17:03
hummm let me download a fresh version and work with it give me a few minutes.
Edited: Done, new version 1.2 will block every message that is not on a forum setup to everyone to see <
Everytime I gives me this error.
Active Server Pages error 'ASP 0113' Script timed out
/oriphan/forum/inc_topmessages.asp
The maximum amount of time for a script to execute was exceeded. You can change this limit by specifying a new value for the property Server.ScriptTimeout or by changing the value in the IIS administration tools.
Am i doing somthing wrong?<
bobby131313
01 March 2008, 22:39
It's not going to work standalone. It needs other include files, so it will have to be included on a forum page to work.<
balexandre
02 March 2008, 05:02
bobby131313:
it works standalone as you can see it here: http://ga-paneuropean.com/gape/test_topMessages.asp
leesh695:
in your page it says: "Top 1 messages!" how is your specifications on the rows and columns?
on this code, use rows = 10 and cols = 1 just for testing and dont change anything else
Code:
TABLE_TYPE_ROWS = 10 ' Number of rows ( Can't be <= 0 ) >> please read note TABLE_TYPE_COLS = 1 ' Number of columns ( Can't be <= 0 ) >> please read note TABLE_TYPE_TOP = TABLE_TYPE_ROWS * TABLE_TYPE_COLS
' NOTE: in order to mantain a reading layout, the SELECT TOP function is determinated by ' multipling Rows by Columns.
' SELECT TOP ( Rows x Columns ) ...
MAX_MESSAGE_LEN = 70 ' Display the first 70 characters MAX_MESSAGE_BREAK_LEN = 40 ' If in thoose 70 charcarters there is no white space, add one OWN_MESSAGE_COLOR = "#E6EFF7" ' Background color of message if it belongs to the user logged in
but it's easy to get the actual error, just comment on error resume next and uncomment on error goto 0 2nd and 3rd line
from this
Code:
on error resume next 'on error goto 0
pass to this
Code:
'on error resume next on error goto 0
and paste the error, or send me directly to bruno [dot] in [dot] dk [at] gmail [dot] com<
richfed
02 March 2008, 08:46
Are we sure the code has been updated at the above link?<
bobby131313
02 March 2008, 11:02
Sorry Bruno, that's what I get for assuming. Anyways, here's the error message...
ADODB.Recordset error '800a0bb9'
Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another.
/inc_topMessages.asp, line 103 <
balexandre
02 March 2008, 12:58
richfed: just check for the correct version of the TXT file, the header must be the same as the header in the 1st topic, if you are seeing version 1.1 refresh the page bobby131313: can you send me your MSN by email please, I will try to help you by MSN cause I can't see what's happening, it seams that the query does not return any row.
-- always remember that the code is online in my forum<
bobby131313
02 March 2008, 13:47
Bruno, I don't have MSN. I'm getting the same message on both my forums...
http://www.coincommunity.com/forum/inc_topMessages.asp
http://www.stampcommunity.org/inc_topMessages.asp
I uncommented the sql line and this is what I get...
SELECT TOP 15 a.CAT_ID, a.FORUM_ID, a.TOPIC_ID, a.T_SUBJECT, a.MSG_ID, a.MSG, a.MSG_DATE, a.MEMBER_ID, a.M_NAME FROM ( SELECT t.CAT_ID, t.FORUM_ID, t.TOPIC_ID, t.T_SUBJECT, '' AS MSG_ID, t.T_MESSAGE AS MSG, t.T_DATE AS MSG_DATE, m.MEMBER_ID, m.M_NAME FROM FORUM_MEMBERS m INNER JOIN FORUM_TOPICS t ON m.MEMBER_ID = t.T_AUTHOR UNION ALL SELECT t.CAT_ID, t.FORUM_ID, t.TOPIC_ID, t.T_SUBJECT, r.REPLY_ID AS MSG_ID, r.R_MESSAGE as MSG, r.R_DATE as MSG_DATE, m.MEMBER_ID, m.M_NAME FROM (FORUM_TOPICS t INNER JOIN FORUM_REPLY r ON t.TOPIC_ID = r.TOPIC_ID) INNER JOIN FORUM_MEMBERS m ON r.R_AUTHOR = m.MEMBER_ID ) a INNER JOIN FORUM_FORUM f ON f.FORUM_ID = a.FORUM_ID WHERE f.F_PRIVATEFORUMS = 0 ORDER BY MSG_DATE DESC; Hopefully that helps.<
richfed
02 March 2008, 15:08
Thanks, Bruno ... got it now. Thank you for your quick assistance on this!<
balexandre
02 March 2008, 15:19
bobby131313 using mySQL, MS SQL or MS Access ?
cause using MS Access and MS SQL it's working fine that SQL query on my Database as you can see it here:
Edited: Added mySQL query image using a fresh install of Snitz Forum (so, only 1 message)<
bobby131313
02 March 2008, 15:38
I'm using MySQL of course. <
balexandre
02 March 2008, 15:55
damm...
let me trying to find a conversion for that code (no mySQL here) ... if any mySQL expert around, fell free to post this code converted. I will them update the version.
SQL Code can be found here Done...
v.1.3 working with mySQL <
bobby131313
02 March 2008, 16:02
I'm almost sure I ran into this with some other mods. I think "Select top" needs to use "topsql" for MySQL. I've been playing with it no luck yet.<
balexandre
02 March 2008, 16:08
can you try the new code bobby131313 ?
and tell me if it works?<
bobby131313
02 March 2008, 16:24
Not yet...
Microsoft VBScript runtime error '800a000d'
Type mismatch: 'TopSQL'
/forum/test_topMessages.asp, line 103 <
balexandre
02 March 2008, 16:36
you need to include the function for testing proposes or using outside the Snitz environment you need this:
Code:
<!--#include file="inc_func_common.asp"-->
when you add the include of inc_topMessages.asp in your default.asp file, this inc_func_common.asp is already included in the header, so you don't need to add it ... but to use as standalone only... you need it in the 1st message in this topic there is a test page that works as standalone MOD, the test_topMessages.asp file has this code:
TABLE_TYPE_ROWS = 2 ' Number of rows ( Can't be <= 0 ) >> please read note TABLE_TYPE_COLS = 5 ' Number of columns ( Can't be <= 0 ) >> please read note
if len(request.QueryString("rows")) > 0 then if isNumeric(request.QueryString("rows")) then TABLE_TYPE_ROWS = cInt(request.QueryString("rows")) end if end if
if len(request.QueryString("cols")) > 0 then if isNumeric(request.QueryString("cols")) then TABLE_TYPE_COLS = cInt(request.QueryString("cols")) end if end if %> <!--#include file="inc_topmessages2.asp"--> <% my_Conn.close() set my_Conn = nothing %>
the inc_topmessages2.asp file only differes from the original code on lines 22 and 23 where they are commented like:
'TABLE_TYPE_ROWS = 10 ' Number of rows ( Can't be <= 0 ) >> please read note 'TABLE_TYPE_COLS = 1 ' Number of columns ( Can't be <= 0 ) >> please read note <
bobby131313
02 March 2008, 16:42
Unfortunately I was trying that as you posted...
ADODB.Recordset error '800a0bb9'
Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another.
/forum/test_topMessages.asp, line 106 <
balexandre
02 March 2008, 16:45
Are you getting any ROWs???
please run the SQL against you database using PHPAdmin for the mySQL database, just run the query and see what is it returning, the SQL code for mySQL is:
FROM ( SELECT t.CAT_ID, t.FORUM_ID, t.TOPIC_ID, t.T_SUBJECT, '' AS MSG_ID, t.T_MESSAGE AS MSG, t.T_DATE AS MSG_DATE, m.MEMBER_ID, m.M_NAME FROM FORUM_MEMBERS m INNER JOIN FORUM_TOPICS t ON m.MEMBER_ID = t.T_AUTHOR
UNION ALL
SELECT t.CAT_ID, t.FORUM_ID, t.TOPIC_ID, t.T_SUBJECT, r.REPLY_ID AS MSG_ID, r.R_MESSAGE as MSG, r.R_DATE as MSG_DATE, m.MEMBER_ID, m.M_NAME FROM (FORUM_TOPICS t INNER JOIN FORUM_REPLY r ON t.TOPIC_ID = r.TOPIC_ID) INNER JOIN FORUM_MEMBERS m ON r.R_AUTHOR = m.MEMBER_ID ) a
INNER JOIN FORUM_FORUM f ON f.FORUM_ID = a.FORUM_ID
WHERE f.F_PRIVATEFORUMS = 0 ORDER BY MSG_DATE DESC LIMIT 20
<
leesh695
02 March 2008, 17:13
This is my error
Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
[MySQL][ODBC 3.51 Driver][mysqld-4.1.22-max-log]You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '1 CAT_ID, FORUM_ID, TOPIC_ID, T_SUBJECT, MSG_ID, MSG, MSG_DATE, MEMBER_ID, M_NAM' at line 1
/oriphan/forum/inc_topMessages.asp, line 99 <
balexandre
02 March 2008, 17:49
leesh695 the code does not have any errors ... as I changed SELECT LIMIT 20 a.... TO SELECT a... LIMIT 20 cause I found that mySQL uses the LIMIT at the end of the code not in front of the SELECT keyword
I installed mySQL and run it into a fresh installation of the SNITZ forum ...
no errors what so ever testing FORUM http://www.ga-paneuropean.com/mysql/
testing MOD under mySQL http://www.ga-paneuropean.com/mysql/test_topMessages.asp
query window: <
bobby131313
02 March 2008, 18:11
Don't know. It won't work.
The file you link to doesn't have the word LIMIT in it anywhere by the way.
No big deal, I appreciate you trying. Maybe there's something I've done before conflicting with it.<
balexandre
02 March 2008, 19:51
the code does not have the word LIMIT eighter TOP, this is made by the line 103
Here's what comes up...
SELECT a.CAT_ID, a.FORUM_ID, a.TOPIC_ID, a.T_SUBJECT, a.MSG_ID, a.MSG, a.MSG_DATE, a.MEMBER_ID, a.M_NAME FROM ( SELECT t.CAT_ID, t.FORUM_ID, t.TOPIC_ID, t.T_SUBJECT, '' AS MSG_ID, t.T_MESSAGE AS MSG, t.T_DATE AS MSG_DATE, m.MEMBER_ID, m.M_NAME FROM FORUM_MEMBERS m INNER JOIN FORUM_TOPICS t ON m.MEMBER_ID = t.T_AUTHOR UNION ALL SELECT t.CAT_ID, t.FORUM_ID, t.TOPIC_ID, t.T_SUBJECT, r.REPLY_ID AS MSG_ID, r.R_MESSAGE as MSG, r.R_DATE as MSG_DATE, m.MEMBER_ID, m.M_NAME FROM (FORUM_TOPICS t INNER JOIN FORUM_REPLY r ON t.TOPIC_ID = r.TOPIC_ID) INNER JOIN FORUM_MEMBERS m ON r.R_AUTHOR = m.MEMBER_ID ) a INNER JOIN FORUM_FORUM f ON f.FORUM_ID = a.FORUM_ID WHERE f.F_PRIVATEFORUMS = 0 ORDER BY MSG_DATE DESC; http://www.coincommunity.com/forum/test_topMessages.asp<
balexandre
02 March 2008, 21:05
you don't have the right version (last version is 1.3, check you file, refresh the code page - maybe you are getting a cached version), but still LIMIT / TOP is only used to get the the first xx messages, without it, you will get every message.
but you still have an error, without having access to the DB I can not help you more, I testing under MS SQL, MS Access and mySQL with a clean Snitz Forum, and all work fine, maybe someone else can help you on this, if I got the same error... but I get no errors whatsoever.<
bobby131313
02 March 2008, 21:33
' 1.3 02.03.08 Updated with TopSQL() so it runs in mySQL as well (>4.x)
Is right out of the file on the server.
It's OK, like I said, I appreciate you trying.<
kolucoms6
12 March 2008, 20:46
Suppose I have One message and 3 ppl replied to same message in last 5 mins.
So, it shows 3 different entries... which is an ODD way...
Cant we get it group by message ?<
balexandre
13 March 2008, 02:40
The MOD is done to include topic messages and replies to those messages!
that is the real "Last XX Messages", if you want only the messages in topics with no replies showing, all you need is to edit the SQL Query to suit your needs.
in your example, the MOD NEEDS to show 4 messages, the 1st message from the topic and the other 3 messages, unless it's a private forum, and that will not appear in the mod <
kolucoms6
13 March 2008, 11:27
Can u plz post the SQL for the same ?<
balexandre
13 March 2008, 14:03
to work with only TOPICS and not REPLIES:
search for:
Code:
sqlstr = "SELECT " & _ "a.CAT_ID, a.FORUM_ID, a.TOPIC_ID, a.T_SUBJECT, a.MSG_ID, a.MSG, a.MSG_DATE, a.MEMBER_ID, a.M_NAME " & _ "FROM ( " & _ "SELECT t.CAT_ID, t.FORUM_ID, t.TOPIC_ID, t.T_SUBJECT, '' AS MSG_ID, t.T_MESSAGE AS MSG, t.T_DATE AS MSG_DATE, m.MEMBER_ID, m.M_NAME " & _ "FROM FORUM_MEMBERS m INNER JOIN FORUM_TOPICS t ON m.MEMBER_ID = t.T_AUTHOR " & _ "UNION ALL " & _ "SELECT t.CAT_ID, t.FORUM_ID, t.TOPIC_ID, t.T_SUBJECT, r.REPLY_ID AS MSG_ID, r.R_MESSAGE as MSG, r.R_DATE as MSG_DATE, m.MEMBER_ID, m.M_NAME " & _ "FROM (FORUM_TOPICS t INNER JOIN FORUM_REPLY r ON t.TOPIC_ID = r.TOPIC_ID) INNER JOIN FORUM_MEMBERS m ON r.R_AUTHOR = m.MEMBER_ID " & _ ") a " & _ "INNER JOIN FORUM_FORUM f ON f.FORUM_ID = a.FORUM_ID " & _ "WHERE f.F_PRIVATEFORUMS = 0 " & _ "ORDER BY MSG_DATE DESC;"
and replace that for this:
Code:
sqlstr = "SELECT " & _ "a.CAT_ID, a.FORUM_ID, a.TOPIC_ID, a.T_SUBJECT, a.MSG_ID, a.MSG, a.MSG_DATE, a.MEMBER_ID, a.M_NAME " & _ "FROM ( " & _ "SELECT t.CAT_ID, t.FORUM_ID, t.TOPIC_ID, t.T_SUBJECT, '' AS MSG_ID, t.T_MESSAGE AS MSG, t.T_DATE AS MSG_DATE, m.MEMBER_ID, m.M_NAME " & _ "FROM FORUM_MEMBERS m INNER JOIN FORUM_TOPICS t ON m.MEMBER_ID = t.T_AUTHOR " & _ ") a " & _ "INNER JOIN FORUM_FORUM f ON f.FORUM_ID = a.FORUM_ID " & _ "WHERE f.F_PRIVATEFORUMS = 0 " & _ "ORDER BY MSG_DATE DESC;"
have in mind that this query if for: Last XX Topics and not Last XX Messages.
hope it helps.<
kolucoms6
13 March 2008, 16:50
Worked.
Cool
Thanks for the Support.<
balexandre
14 March 2008, 11:29
always glad to help the community<
puzo
19 March 2008, 17:02
Thank you, very useful.<
championc
06 April 2008, 18:36
Hi Bruno,
Super job. I have installed this against my mySQL installation and it worked perfectly first time.
I wonder if you have ever done a further mod to show the Forum Name - if not, what extra code would I need to do this. I know I would need to use the t.FORUM_ID to read the forum name (F_SUBJECT) from the forum_forum table
C <
championc
08 April 2008, 16:27
I worked it out - dead easy when it came down to it. I simply replaced the top line of the strsql from sqlstr = "SELECT " & _ "a.CAT_ID, a.FORUM_ID, a.TOPIC_ID, a.T_SUBJECT, a.MSG_ID, a.MSG, a.MSG_DATE, a.MEMBER_ID, a.M_NAME " & _
You can then use objRec.fields("F_SUBJECT") to retrieve the category description
C <
gjs
03 June 2009, 15:47
Hello.
I am using this cool mod on my forum, but now also want to integrate the events calendar mod.
However, the posts that go in the events calendar also come up in the most recent messages.
Can you give some modified SQL to exclude the posts added to the events calendar from coming up in the top x messages?
Many Thanks,
Greg.
Etymon
04 June 2009, 20:56
You may want to contact the author of this via e-mail through his profile. He may not see your question as quickly as you are perhaps needing the help.
gjs
05 June 2009, 16:36
Thanks for the suggestion - I'll try that now.
Regards,
Greg
balexandre
16 June 2009, 18:05
I already replied him on his email, no feedback since
pierretopping
06 July 2009, 16:52
Originally posted by leesh695 I have tried this out,
Everytime I gives me this error.
Active Server Pages error 'ASP 0113' Script timed out
/oriphan/forum/inc_topmessages.asp
The maximum amount of time for a script to execute was exceeded. You can change this limit by specifying a new value for the property Server.ScriptTimeout or by changing the value in the IIS administration tools.
Am i doing somthing wrong?<
Hi I' get the same timeout, did anybody get the fix for this great mod ?
richfed
17 October 2009, 17:55
Balexandre -
Is there a way to eliminate this MOD from displaying any posts from a specific forum?
I have just installed MarcelG's blog MOD and would like to prevent blog posts from appearing. Blogs are posted in one specific forum and I would like to block it. What code would I use and where would I place it? Forum ID is "71".
Jays
13 April 2010, 14:32
I would like to use this mod in the left hand side of Site Integration, but it throws my alignment to the right and about halfway over the screen.
Can anyone tell me how to fix this problem
TIA Jays
balexandre
14 April 2010, 18:00
using Firebug in Firefox you can see what is going on.
I have no idea how Site Integration handles HTML, with no link and nothing more than your message, I have no idea how you think you should have help
Jays
15 April 2010, 08:57
Thank you for your response, here is a link to my site http://newsthatsused.com/newsthatsused/aion/forum/ I am using Internet Explorer
I'm wondering if it has anything to do will the "select case session.lcid" which I have included below. The first part is written in Portuguese (I'm assuming).
select case session.lcid case 2070 ' PT-pt strTop10TopMsg = "Últimas " & cStr(TABLE_TYPE_TOP) & " mensagens!" strTop10MsgBottomLink = "Últimos tópicos activos" strTop10MsgTopic = "Tópico" strTop10MsgBy = "por" strTop10MsgIn = "em" strTop10Error = "TABLE_TYPE_ROWS e/ou TABLE_TYPE_COLS não são um valor numerico!" case else ' All the others strTop10TopMsg = "Top " & cStr(TABLE_TYPE_TOP) & " messages!" strTop10MsgBottomLink = "Active topics" strTop10MsgTopic = "Topic" strTop10MsgBy = "by" strTop10MsgIn = "in" strTop10Error = "TABLE_TYPE_ROWS and/or TABLE_TYPE_COLS are not a numeric value!" end select
TIA Jays
Jays
16 April 2010, 09:06
Sorry, I had to remove it from my site, but thank you anyway.
I suspect I have an open tag somewhere