Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Snitz Forums 2000 MOD-Group
 MOD Add-On Forum (W/Code)
 Show how many messages since yours IN PAGE TITLE

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!
Before posting, make sure you have read this topic!

Screensize:
UserName:
Password:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkInsert EmailInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
balexandre Posted - 26 May 2007 : 06:16:47
I just made this for my self as an add-on of what I did in the Forum main page (show the last 10 messages posted).

the objective was something like "GMAIL - Inbox (3)" and this is the code I uses in my page.

you can have the same in 2 steps please note that this is only to change the title of the page, the Top 10 messages that you can see in the images below ARE NOT included in this tutorial, another thing is, this only works with Access DB and MySQL above version 4.x.

  • ADD THIS IN inc_header.asp BEFORE the 2nd response.write function that had the tag:
    <title>
    (so, search for
    <title>
    , the 2nd one STOP and scroll up until you get the response.write, above that line, paste the include)

    paste this:

    %><!--#INCLUDE FILE="inc_showMsgNrOnTitle.asp"><%

  • in a new file called
    inc_showMsgNrOnTitle.asp

    paste this:

    <%
    ' ********************************************************************************************
    ' SHOW NUMBER OF NEW MESSAGES IN TITLE IF LOGGED IN (MORE THAN 20, WILL OUTPUT +20)
    ' Built in: 26th May 2007 by Bruno Alexandre <bruno.in.dk@gmail.com>
    ' version: 0.0.2 | (29th May 2007) | updated with TopSQL() so it runs in mySQL as well (>4.x)
    ' version: 0.0.1 | (26th May 2007) | Mod Start
    ' ********************************************************************************************
    strNewMessages = ""
    intNewMessages = 0
    ' We only see the messages if the user is Logged In
    if strDBNTUserName <> "" then
    ' Get the last 20 messages order by Date
    sqlstr = "SELECT M_NAME FROM ( " & _
    "SELECT " & strTablePrefix & "TOPICS.CAT_ID, " & strTablePrefix & "TOPICS.FORUM_ID, " & strTablePrefix & "TOPICS.TOPIC_ID, " & strTablePrefix & "TOPICS.T_SUBJECT, '' AS MSG_ID, " & strTablePrefix & "TOPICS.T_MESSAGE AS MSG, " & strTablePrefix & "TOPICS.T_DATE AS MSG_DATE, " & strTablePrefix & "MEMBERS.MEMBER_ID, " & strTablePrefix & "MEMBERS.M_NAME " & _
    "FROM " & strTablePrefix & "MEMBERS INNER JOIN " & strTablePrefix & "TOPICS ON " & strTablePrefix & "MEMBERS.MEMBER_ID = " & strTablePrefix & "TOPICS.T_AUTHOR " & _
    "UNION ALL " & _
    "SELECT " & strTablePrefix & "TOPICS.CAT_ID, " & strTablePrefix & "TOPICS.FORUM_ID, " & strTablePrefix & "TOPICS.TOPIC_ID, " & strTablePrefix & "TOPICS.T_SUBJECT, " & strTablePrefix & "REPLY.REPLY_ID AS MSG_ID, " & strTablePrefix & "REPLY.R_MESSAGE as MSG, " & strTablePrefix & "REPLY.R_DATE as MSG_DATE, " & strTablePrefix & "MEMBERS.MEMBER_ID, " & strTablePrefix & "MEMBERS.M_NAME " & _
    "FROM (" & strTablePrefix & "TOPICS INNER JOIN " & strTablePrefix & "REPLY ON " & strTablePrefix & "TOPICS.TOPIC_ID = " & strTablePrefix & "REPLY.TOPIC_ID) INNER JOIN " & strTablePrefix & "MEMBERS ON " & strTablePrefix & "REPLY.R_AUTHOR = " & strTablePrefix & "MEMBERS.MEMBER_ID " & _
    ") a " & _
    "ORDER BY MSG_DATE DESC;"

    Set objRec = Server.CreateObject ("ADODB.Recordset")
    objRec.Open TopSQL(sqlstr, 20), My_Conn
    objRec.moveFirst()
    do until objRec.EOF
    if objRec.fields("M_NAME") = strDBNTUserName then
    ' Found a message from the CurrentUser, so Get out!
    exit do
    else
    ' The message is not from the Current User, so let's Add it to the variable
    intNewMessages = intNewMessages + 1
    end if
    objRec.moveNext()
    loop

    if intNewMessages > 0 then
    ' if the are new messages, let's surround it with curve brackets
    if objRec.EOF then
    ' there are more than 20, so, instead of looping all we show +20
    strNewMessages = "(+" & intNewMessages & ")"
    else
    strNewMessages = "(" & intNewMessages & ")"
    end if
    strNewMessages = "(" & intNewMessages & ")"
    strScriptName = strScriptName & strNewMessages
    end if

    objRec.close
    set objRec = Nothing
    end if
    %>



Hope you find this useful

my Forum: www.ga-paneuropean.com




www.ga-paneuropean.com/gape.v2/ajuda/NrMoreMessages2.gif" border="0">


www.ga-paneuropean.com/gape.v2/ajuda/NrMoreMessages.gif" border="0">


<
15   L A T E S T    R E P L I E S    (Newest First)
phy1729 Posted - 10 July 2008 : 16:17:34
It already has been
http://forum.snitz.com/forum/topic.asp?TOPIC_ID=65954<
Target_Locked Posted - 12 November 2007 : 21:58:02
quote:
Originally posted by balexandre

well, this topic only concerns in showing how many messages since your last message, and the code it's here

for the Latest Top 10 messages, that I think that is what you are interest in, I need to pick up the code and implemented in a MOD, it's just one file and you include it where you need, right now, it's a vertical table, and the Snitz Forum as you know does not have that space at the forum left side... I had to edit the include header file for that effect, I will create a new topic with the file you need.



"Latest Top 10 messages"
That's what I am looking for. Hoping that your MOD will be released soon.<
balexandre Posted - 08 November 2007 : 03:37:13
well, this topic only concerns in showing how many messages since your last message, and the code it's here

for the Latest Top 10 messages, that I think that is what you are interest in, I need to pick up the code and implemented in a MOD, it's just one file and you include it where you need, right now, it's a vertical table, and the Snitz Forum as you know does not have that space at the forum left side... I had to edit the include header file for that effect, I will create a new topic with the file you need.

<
Target_Locked Posted - 07 November 2007 : 22:32:40
Hi Bruno Alexandre,
Could you show detailed instruction to implement your MOD. Such as which file, go to which line number? and how that line look like?
and what ver of Snitz was tested?
Thanks.<
balexandre Posted - 29 May 2007 : 07:00:08
nice one AnonJr

updated !

(2 many functions and not that inside the core of the Forum code )

kolucoms6
I don't have it so you can modify, I will do it with documentation, it's a <TABLE> with all the info so you will need to know the code to get the best position on it.

to get my "layout" you need to change a lot in the original forum, cause it's tricky.

I can do something so you can ADD on top of the Forum or at Bottom, using for example 5 messages in a row and so you will have 2 rows with the last 10 messages...

do you need this? send me an email if you prefer (u can find it on the code, or use the Forum send email function).<
AnonJr Posted - 27 May 2007 : 14:32:51
Good catch. Best solution would probably be to use the TopSQL() function - its found in inc_func_common.asp.<
modifichicci Posted - 27 May 2007 : 11:58:54
Remember that
SELECT TOP 20 doesn't work in mysql it needs LIMIT 20<
kolucoms6 Posted - 27 May 2007 : 11:30:42

Can you put/place the code to diaplay last 10 messages in left bar ?(I know you have to use active.asp kind of code)<
balexandre Posted - 26 May 2007 : 10:41:13
never used mySQL, and I do not know what are the differences on t-sql, my world is only MS SQL

please fell free to update a T-SQL Code

about looping, yes, but my Access Database knowledge is limited and only led me to that, in MS SQL, I would use an SP, retrieve both count and sum ... easy, but not supported by Access.

But: I changed the code, so now I request the TOP 20 and if more than 20 I simple say (+20) instead of looping all the messages in the Database... this was a really issue if the user is a new member and not yet any posts <Obrigado!>

As suggested, I will edit my post and add that message about UNION function

about the images... humm, I even added "Objective", the Top 10 messages is other MOD that I created, and like AnonJR said, I will post it as well, but right now it's codded for my Forum, and no comments or other options as 1 vertical table with all 10 messages.

to place the MOD I should, at least, place some options, like Vertical / Horizontal and how many Rows / Columns<
ruirib Posted - 26 May 2007 : 10:38:46
You should make it clear that this is supported only in SGBDs that support UNION queries, which excludes MySQL versions previous to 4.x. Also, the images posted are a bit misleading, since the code will only change the title of the page in a normal base Snitz version.

As a comment not meant to be seen in a negative light, the current code can be quite inefficient, since it needs to navigate through all the records to find out the total number of new posts. You could use the current UNION query as subquery of a new query just to count the number records returned by the UNION query and then just retrieve the returned value.

As an alternative, two SELECT COUNT(*) queries, one for the topics, another for replies, would do it too. This latter option would even be available to MySQL 3.x databases.<
balexandre Posted - 26 May 2007 : 10:23:42
Now you lost me ...

single file?

all you need to do is copy that code in the scrolling window into a new file and rename it, saving into your forum root directory where all the forum files are, then search inside inc_header.asp for the second <title> and include that line above the response.write function for that 2nd <title><
kolucoms6 Posted - 26 May 2007 : 09:51:35

Is it ready to download as a single file ?<
balexandre Posted - 26 May 2007 : 08:52:48
just added some pictures so everyone knows what's the propose of this code <
AnonJr Posted - 26 May 2007 : 08:44:58
quote:
Originally posted by balexandre

didn't know about scrollcode done !

Glad to help.

quote:
Originally posted by balexandre

humm... It's a nice ideia, but I can do that for yourself and show the code, I don't thing I'll used it cause... if you're not login, just click the Active posts link

the Objective is 2 be logged in and minimize the window or put the window in a new tab, and soon someone put's a message you can see it right away

I kinda figured that. It was just a thought.


quote:
Originally posted by balexandre

By the way,

do you think I should put here the code for the Top 10 Messages MOD that I created in the forum?

Sure. We try to encourage everybody post back fun code like that - it helps the community grow. <
balexandre Posted - 26 May 2007 : 07:36:47
didn't know about scrollcode done !

humm... It's a nice ideia, but I can do that for yourself and show the code, I don't thing I'll used it cause... if you're not login, just click the Active posts link

the Objective is 2 be logged in and minimize the window or put the window in a new tab, and soon someone put's a message you can see it right away

but if you want I can add that feature! to many years under ASP / T-SQL... that's simple to implement.

By the way,

do you think I should put here the code for the Top 10 Messages MOD that I created in the forum?<

Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.05 seconds. Powered By: Snitz Forums 2000 Version 3.4.07