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/O Code)
 Portal Content request
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

StephenD
Senior Member

Australia
1044 Posts

Posted - 31 May 2005 :  01:55:18  Show Profile  Send StephenD a Yahoo! Message
I've seen on some other non-snitz portals a simple list of forums with the number of topics in each displayed like:

Have Your Say (3)
General (24)
After Hours (14)
Help (58)

etc etc.

I'd like to do something similar using the opentable and closetable code on David's Portal Mod. I'm looking for the code that will list the Forum names and count the no. of Topics in each. Can anyone point me in the right direction please.

StephenD
Senior Member

Australia
1044 Posts

Posted - 31 May 2005 :  23:26:11  Show Profile  Send StephenD a Yahoo! Message
OK I've made a start .. obviously my code is pretty awful but I know it is kinda in the right direction:
sub ListForums(byval Width)

Dim TopicCount, rsForum, Forum_Subject
	
'## Forum_SQL
strSql = "SELECT "F.F_SUBJECT, " & _
	 "C.CAT_ID, " & _
	 "COUNT( & strTablePrefix & "TOPICS T,), " & _
	 "FROM " & strTablePrefix & "FORUM F, " & _
	 strTablePrefix & "CATEGORY C, " & _
	 "WHERE C.CAT_ID=2"
	 strSql = strSql & "AND F.FORUM_ID = T.FORUM_ID " & _
	 "AND C.CAT_ID = T.CAT_ID "    
	 strSql = strSql & ") "
	strSql = strSql & " ORDER BY C.CAT_ORDER, C.CAT_NAME, F.F_ORDER " 
	
	tF_SUBJECT = 0
        tCAT_ID = 1
        
        rec = 1
	for iTopic = 0 to iTopicCount
	Forum_Subject = arrTopicData(tF_SUBJECT,iTopic)
	Cat_ID = arrTopicData(tCAT_ID,iTopic)
	
	set rsForum = my_Conn.Execute(strSql)
	Forum_Subject = rsForum.Fields("F_SUBJECT").Value
	TopicCount = rsForum.Fields(COUNT(TOPICS))
	 
		
	call StartTable("100%", "Forum List")
	 
	 do while NOT rsForum.EOF
         Response.Write   "			"& rsForum.Fields("Forum_Subject").Value & "(" & Topic_Count & ")" & "<br />" & vbNewLine

         	rsContList.MoveNext
	loop
	
	set rsForum = nothing

	call EndTable()
end sub


Any pointers (except take up macrame instead ?
Go to Top of Page

Shaggy
Support Moderator

Ireland
6780 Posts

Posted - 01 June 2005 :  05:29:03  Show Profile
A quick cleanup, if I may be so bold
sub ListForums(byval Width)
	dim TopicCount,rsForum,Forum_Subject
	strSql="SELECT F_SUBJECT,F_TOPICS FROM "&strTablePrefix&"FORUM WHERE CAT_ID=2 ORDER BY F_ORDER ASC,F_SUBJECT ASC"
	set rsForum=my_Conn.execute(strSql)
	if not rsForum.eof then
		call StartTable("100%","Forum List")
		do until rsForum.eof
			Forum_Subject=chkString(rsForum.fields(0).value,"display")
			TopicCount=clng(rsForum.fields(1).value)
			response.write	"			"&Forum_Subject&" ("&Topic_Count&")<br />"&vbNewLine
			rsForum.movenext
		loop
		call EndTable()
	end if
	rsForum.close
	set rsForum=nothing
end sub
Do you want to link people to the forums listed or is is just a list ing?


Search is your friend
“I was having a mildly paranoid day, mostly due to the
fact that the mad priest lady from over the river had
taken to nailing weasels to my front door again.”

Edited by - Shaggy on 01 June 2005 05:30:12
Go to Top of Page

StephenD
Senior Member

Australia
1044 Posts

Posted - 01 June 2005 :  08:26:42  Show Profile  Send StephenD a Yahoo! Message
Thank you for your help Shaggy, that lists the forums Ok but the topic count is null.
Go to Top of Page

Shaggy
Support Moderator

Ireland
6780 Posts

Posted - 01 June 2005 :  08:27:54  Show Profile
Sorry, forgot to remove a stray underscore you had in your code: In the response,write line, delete the _ between Topic and Count.


Search is your friend
“I was having a mildly paranoid day, mostly due to the
fact that the mad priest lady from over the river had
taken to nailing weasels to my front door again.”
Go to Top of Page

StephenD
Senior Member

Australia
1044 Posts

Posted - 01 June 2005 :  14:52:18  Show Profile  Send StephenD a Yahoo! Message
Thanks Shaggy, perfect!
Go to Top of Page

Shaggy
Support Moderator

Ireland
6780 Posts

Posted - 02 June 2005 :  05:21:31  Show Profile
You're welcome, man


Search is your friend
“I was having a mildly paranoid day, mostly due to the
fact that the mad priest lady from over the river had
taken to nailing weasels to my front door again.”
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.23 seconds. Powered By: Snitz Forums 2000 Version 3.4.07