Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Snitz Forums 2000 MOD-Group
 MOD Add-On Forum (W/Code)
 Displaying the number of active topics on homepage
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

WrightA
Starting Member

4 Posts

Posted - 06 September 2003 :  04:54:52  Show Profile
Hi,

My site has a forum, which visitors can access by using the 'forum' link from the menu. A nice change I'd like to do is to display the number of active topics on the homepage of the site, so that the visitor knows straight away if there are new posts to read.

Would this simply be a copy and paste of code into my homepage, or is it more complex than that.

Any help, pointers greatly appreciated,

Thanks,

WrightA

Edited by - ruirib on 06 September 2003 06:24:32

mortioli
Average Member

United Kingdom
898 Posts

Posted - 06 September 2003 :  05:00:07  Show Profile  Visit mortioli's Homepage  Send mortioli an AOL message  Send mortioli a Yahoo! Message
I have a small count on my forums (www.ckyalliance.co.uk/forum) next to the Active Topic link.

If I remember, this is what I did:

Find:

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


and add this below:

dim ActiveTopicCount



Then find:

select case Request.Form("Method_Type")
	case "login"
		strEncodedPassword = sha256("" & Request.Form("Password"))
		select case chkUser(strDBNTFUserName, strEncodedPassword,-1)
			case 1, 2, 3, 4
				Call DoCookies(Request.Form("SavePassword"))
				strLoginStatus = 1
			case else
				strLoginStatus = 0
			end select
	case "logout"
		Call ClearCookies()
end select



And add this above:

ActiveTopicCount = -1
if IsEmpty(Session(strCookieURL & "last_here_date")) then
	Session(strCookieURL & "last_here_date") = ReadLastHereDate(strDBNTUserName)
end if
if not IsNull(Session(strCookieURL & "last_here_date")) then 
	if not blnHiddenForums then

		'## Forum_SQL - Get ActiveTopicCount from DB
		strSql = "SELECT COUNT(" & strTablePrefix & "TOPICS.T_LAST_POST) AS NUM_ACTIVE "
		strSql = strSql & "FROM " & strTablePrefix & "TOPICS "
		strSql = strSql & "WHERE (((" & strTablePrefix & "TOPICS.T_LAST_POST)>'"& Session(strCookieURL & "last_here_date") & "'))"
		strSql = strSql & " AND " & strTablePrefix & "TOPICS.T_STATUS <= 1"

		set rs = my_Conn.Execute(strSql)
			
		if not rs.EOF then
			ActiveTopicCount = rs("NUM_ACTIVE")
		else
			ActiveTopicCount = 0
		end if
	end if
end if



Then replace the Active Topic link with this:

"          <a href=""active.asp""" & dWStatus("See what topics have been active since your last visit...") & " tabindex=""-1""><acronym title=""See what topics have been active since your last visit..."">Active Topics"
			if ActiveTopicCount > 0 then  Response.Write " (<font color=""" & strHoverFontColor & """><b>" & ActiveTopicCount & "</b></font>)"



I think that's right, but I may be wrong. Sorry

Anyway, just use the same idea on your homepage
Go to Top of Page

WrightA
Starting Member

4 Posts

Posted - 06 September 2003 :  11:03:20  Show Profile
Cheers,

I notice you also have an Active Users page, could you post the code for that please?

Cheers

WrightA
Go to Top of Page

Links Shadow
Starting Member

3 Posts

Posted - 06 September 2003 :  11:41:54  Show Profile  Visit Links Shadow's Homepage
Are those changes done to the inc_header.asp file, if not which ones need to be changed to have that appear on all pages like you have mortioli?

Edited by - Links Shadow on 06 September 2003 11:48:21
Go to Top of Page

dayve
Forum Moderator

USA
5820 Posts

Posted - 06 September 2003 :  13:04:27  Show Profile  Visit dayve's Homepage
this mod does not work if you change the drop list value for Active Topics Since.

Go to Top of Page

mortioli
Average Member

United Kingdom
898 Posts

Posted - 06 September 2003 :  16:01:38  Show Profile  Visit mortioli's Homepage  Send mortioli an AOL message  Send mortioli a Yahoo! Message
Yeah the changes are done in inc_header.asp

dayve, the Active Topics since doesn't save your chosen amount of time does it?

The Active Users would be...

Above where you add the large part of the Active Topic code, add:

'### ACTIVE USER COUNT - OJM ADDED ###
intTotalActiveMembers = 0
intTotalActiveGuests = 0
intTotalActiveUsers = 0

'## Ls3k - Before we can do anything we need to get rid of those slackers who have left ;)
deleteInactiveUsers()

'## Ls3k - Get counts
strSql = "SELECT COUNT(AU_IP) AS CNT FROM " & strTablePrefix & "ACTIVE_USERS WHERE MEMBER_ID = -1"
set rs = my_conn.execute (strSql)
intTotalActiveGuests = rs("CNT")
rs.close
set rs = nothing

strSql = "SELECT COUNT(MEMBER_ID) AS CNT FROM " & strTablePrefix & "ACTIVE_USERS WHERE MEMBER_ID <> -1"
set rs = my_conn.execute (strSql)
intTotalActiveMembers = rs("CNT")
rs.close
set rs = nothing

intTotalActiveUsers = intTotalActiveMembers + intTotalActiveGuests
'### ACTIVE USER COUNT - OJM ADDED ###



Then the Active Users link would be:

"          <a href=""active_users.asp""" & dWStatus("See who is online...") & " tabindex=""-1""><acronym title=""See who is online..."">Active Users (<font color=""" & strHoverFontColor & """><b>" & intTotalActiveUsers & "</b></font>)</acronym></a>" & vbNewline & _
Go to Top of Page

dayve
Forum Moderator

USA
5820 Posts

Posted - 07 September 2003 :  00:07:19  Show Profile  Visit dayve's Homepage
quote:
Originally posted by mortioli


dayve, the Active Topics since doesn't save your chosen amount of time does it?



it could if you wrote it to a session or cookie like so...

Response.Cookies("lastDate") = lastDate

in the Active Topics page. I have not tried this but I'm sure something like this would work. You could then replace your SQL statement to compare to this cookie instead of the default last visit session object.

Go to Top of Page

mortioli
Average Member

United Kingdom
898 Posts

Posted - 07 September 2003 :  03:53:23  Show Profile  Visit mortioli's Homepage  Send mortioli an AOL message  Send mortioli a Yahoo! Message
I don't think anyone uses the last seen part (on my forums), so I'll leave it. Cheers anyway!
Go to Top of Page

ssnapier
Junior Member

USA
126 Posts

Posted - 08 September 2003 :  10:57:06  Show Profile  Visit ssnapier's Homepage  Send ssnapier an AOL message  Send ssnapier an ICQ Message  Send ssnapier a Yahoo! Message
off topic, but CKY is pretty funny!!!!!!! I crack up every time I listen to the Chinese freestyle clip... LOL


If freedom were shareware, soldiers are the ones who pay for it.
Go to Top of Page

wii
Free ASP Hosts Moderator

Denmark
2632 Posts

Posted - 08 January 2004 :  13:21:00  Show Profile
I also use this code, but could we fix it, so users don´t have to refresh before actually seeing the correct number?

I mean, if you visit the forum and there are 6 users online (according to the active user count in the default.asp page), it will show only 5 at the top using the below code, after refreshing the page, it will show the correct number 6.

quote:
Originally posted by mortioli

Yeah the changes are done in inc_header.asp

dayve, the Active Topics since doesn't save your chosen amount of time does it?

The Active Users would be...

Above where you add the large part of the Active Topic code, add:

'### ACTIVE USER COUNT - OJM ADDED ###
intTotalActiveMembers = 0
intTotalActiveGuests = 0
intTotalActiveUsers = 0

'## Ls3k - Before we can do anything we need to get rid of those slackers who have left ;)
deleteInactiveUsers()

'## Ls3k - Get counts
strSql = "SELECT COUNT(AU_IP) AS CNT FROM " & strTablePrefix & "ACTIVE_USERS WHERE MEMBER_ID = -1"
set rs = my_conn.execute (strSql)
intTotalActiveGuests = rs("CNT")
rs.close
set rs = nothing

strSql = "SELECT COUNT(MEMBER_ID) AS CNT FROM " & strTablePrefix & "ACTIVE_USERS WHERE MEMBER_ID <> -1"
set rs = my_conn.execute (strSql)
intTotalActiveMembers = rs("CNT")
rs.close
set rs = nothing

intTotalActiveUsers = intTotalActiveMembers + intTotalActiveGuests
'### ACTIVE USER COUNT - OJM ADDED ###



Then the Active Users link would be:

"          <a href=""active_users.asp""" & dWStatus("See who is online...") & " tabindex=""-1""><acronym title=""See who is online..."">Active Users (<font color=""" & strHoverFontColor & """><b>" & intTotalActiveUsers & "</b></font>)</acronym></a>" & vbNewline & _


Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.22 seconds. Powered By: Snitz Forums 2000 Version 3.4.07