Author |
Topic |
balexandre
Junior Member
Denmark
418 Posts |
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:
- in a new file called
inc_showMsgNrOnTitle.asp paste this:
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">
< |
Bruno Alexandre (Strøby, DANMARK)
"a Portuguese in Danmark"
|
Edited by - balexandre on 10 July 2008 15:58:18 |
|
AnonJr
Moderator
United States
5768 Posts |
Posted - 26 May 2007 : 06:43:21
|
Is it something you have to be logged in to see?< |
|
|
balexandre
Junior Member
Denmark
418 Posts |
Posted - 26 May 2007 : 07:05:31
|
only logged in you will be able to see that, cause... How can the MOD know who you are to tell you how many new messages are since your last one?
< |
Bruno Alexandre (Strøby, DANMARK)
"a Portuguese in Danmark"
|
|
|
AnonJr
Moderator
United States
5768 Posts |
Posted - 26 May 2007 : 07:19:16
|
You could do like active.asp does - if you're not logged in it shows all the active topics for the last 30 days. Likewise, if not logged in you could have the number of topics for the last 30 days. Or you could just provide a generic login so we can see it in action.
Also, these forums (as in here, not in the actual base code) have a neat little undocumented feature - [scrollcode] tags. It was added so you could post huge chunks of code like that without stretching the posts. Just a friendly tip. < |
Edited by - AnonJr on 26 May 2007 07:20:54 |
|
|
balexandre
Junior Member
Denmark
418 Posts |
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?< |
Bruno Alexandre (Strøby, DANMARK)
"a Portuguese in Danmark"
|
Edited by - balexandre on 26 May 2007 07:50:12 |
|
|
AnonJr
Moderator
United States
5768 Posts |
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
Junior Member
Denmark
418 Posts |
Posted - 26 May 2007 : 08:52:48
|
just added some pictures so everyone knows what's the propose of this code < |
Bruno Alexandre (Strøby, DANMARK)
"a Portuguese in Danmark"
|
|
|
kolucoms6
Average Member
845 Posts |
Posted - 26 May 2007 : 09:51:35
|
Is it ready to download as a single file ?< |
|
|
balexandre
Junior Member
Denmark
418 Posts |
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>< |
Bruno Alexandre (Strøby, DANMARK)
"a Portuguese in Danmark"
|
Edited by - balexandre on 26 May 2007 10:28:05 |
|
|
ruirib
Snitz Forums Admin
Portugal
26364 Posts |
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.< |
Snitz 3.4 Readme | Like the support? Support Snitz too |
|
|
balexandre
Junior Member
Denmark
418 Posts |
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< |
Bruno Alexandre (Strøby, DANMARK)
"a Portuguese in Danmark"
|
Edited by - balexandre on 26 May 2007 10:58:39 |
|
|
kolucoms6
Average Member
845 Posts |
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)< |
|
|
modifichicci
Average Member
Italy
787 Posts |
|
AnonJr
Moderator
United States
5768 Posts |
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.< |
|
|
balexandre
Junior Member
Denmark
418 Posts |
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).< |
Bruno Alexandre (Strøby, DANMARK)
"a Portuguese in Danmark"
|
Edited by - balexandre on 29 May 2007 07:12:38 |
|
|
Target_Locked
Starting Member
Vietnam
38 Posts |
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.< |
Snitz 2000 Ver 3.4.06 |
Edited by - Target_Locked on 07 November 2007 22:49:17 |
|
|
Topic |
|
|
|