The Forum has been Updated
The code has been upgraded to the latest .NET core version. Please check instructions in the Community Announcements about migrating your account.
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.
my Forum: www.ga-paneuropean.com
<
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: Code:(so, search for
<title>Code:, the 2nd one STOP and scroll up until you get the response.write, above that line, paste the include)<title>
paste this:Code:%><!--#INCLUDE FILE="inc_showMsgNrOnTitle.asp"><% - in a new file called Code:paste this:
inc_showMsgNrOnTitle.aspCode:<%
' ********************************************************************************************
' 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
%>
my Forum: www.ga-paneuropean.com
<