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)
 Mark topics where I posted
 New Topic  Reply to Topic
 Printer Friendly
Previous Page | Next Page
Author Previous Topic Topic Next Topic
Page: of 3

tribaliztic
Senior Member

Sweden
1532 Posts

Posted - 21 December 2005 :  02:36:46  Show Profile  Visit tribaliztic's Homepage  Send tribaliztic an ICQ Message  Reply with Quote
Did it slow down the forums much? If not I'd love to have a look at it =)
<

/Tribaliztic
- www.gotlandrace.se -
Go to Top of Page

cripto9t
Average Member

USA
881 Posts

Posted - 21 December 2005 :  08:06:09  Show Profile  Reply with Quote
I never used it on a live forum, just something I was playing around with. I'll go through it today to make sure it works and trim the code as best I can.

There are just 4 or 5 changes on forum.asp and you would have to find a couple of icons to add to your files. I'll post the changes here so everyone can see them and maybe get some opinions.<

    _-/Cripto9t\-_
Go to Top of Page

tribaliztic
Senior Member

Sweden
1532 Posts

Posted - 21 December 2005 :  08:11:44  Show Profile  Visit tribaliztic's Homepage  Send tribaliztic an ICQ Message  Reply with Quote
Cool! Thanks alot!
<

/Tribaliztic
- www.gotlandrace.se -
Go to Top of Page

cripto9t
Average Member

USA
881 Posts

Posted - 21 December 2005 :  17:17:33  Show Profile  Reply with Quote

    _-/Cripto9t\-_

Edited by - cripto9t on 23 December 2005 11:39:11
Go to Top of Page

-gary
Development Team Member

406 Posts

Posted - 21 December 2005 :  17:32:43  Show Profile  Reply with Quote
That'll cause a ton of extra DB calls for a typical page view. I wouldn't recommend it unless you have a decent server or little concurrent traffic.

For my forum, I just threw in a join with a having in the post selection statement and display an arrow when you're posted or replied.<

KawiForums.com


Go to Top of Page

tribaliztic
Senior Member

Sweden
1532 Posts

Posted - 22 December 2005 :  02:39:54  Show Profile  Visit tribaliztic's Homepage  Send tribaliztic an ICQ Message  Reply with Quote
-gary: that's what I'm afraid of, can you explain alittle further what you did? =)

Cripto9t: Thanks alot, I'll try that on another forum and see how it works.
<

/Tribaliztic
- www.gotlandrace.se -
Go to Top of Page

cripto9t
Average Member

USA
881 Posts

Posted - 22 December 2005 :  10:14:17  Show Profile  Reply with Quote
Going with garys advice :) I came up with this after working out
a few problems with the mySql specific code and this has only been tested in mySql.

'## Forum_SQL - Get all topics from DB
strSql ="SELECT T.T_STATUS, T.CAT_ID, T.FORUM_ID, T.TOPIC_ID, T.T_VIEW_COUNT, T.T_SUBJECT, " 
strSql = strSql & "T.T_AUTHOR, T.T_STICKY, T.T_REPLIES, T.T_UREPLIES, T.T_LAST_POST, T.T_LAST_POST_AUTHOR, "  
strSql = strSql & "T.T_LAST_POST_REPLY_ID, M.M_NAME, MEMBERS_1.M_NAME AS LAST_POST_AUTHOR_NAME "
strSql = strSql & ", COUNT(R.R_AUTHOR) AS REPLIES "

strSql2 = " FROM " & strMemberTablePrefix & "MEMBERS M, "
strSql2 = strSql2 & strActivePrefix & "TOPICS T, " 
strSql2 = strSql2 & strMemberTablePrefix & "MEMBERS AS MEMBERS_1 "

strSql6 = "LEFT JOIN " & strActivePrefix & "REPLY R "
strSql6 = strSql6 & "ON T.TOPIC_ID = R.TOPIC_ID AND R.R_AUTHOR = " & MemberID & " "

strSql3 = " WHERE M.MEMBER_ID = T.T_AUTHOR "
strSql3 = strSql3 & " AND T.T_LAST_POST_AUTHOR = MEMBERS_1.MEMBER_ID "
strSql3 = strSql3 & " AND T.FORUM_ID = " & Forum_ID & " "
if nDays = "-1" then
	if strStickyTopic = "1" then
		strSql3 = strSql3 & " AND (T.T_STATUS <> 0 OR T.T_STICKY = 1)"
	else
		strSql3 = strSql3 & " AND T.T_STATUS <> 0 "
	end if
end if
if nDays > "0" then
	if strStickyTopic = "1" then
		strSql3 = strSql3 & " AND (T.T_LAST_POST > '" & defDate & "' OR T.T_STICKY = 1)"
	else
		strSql3 = strSql3 & " AND T.T_LAST_POST > '" & defDate & "'"
	end if
end if
' DEM --> if not a Moderator, all unapproved posts should not be viewed.
if AdminAllowed = 0 then 
	strSql3 = strSql3 & " AND ((T.T_AUTHOR <> " & MemberID
	strSql3 = strSql3 & " AND T.T_STATUS < "  ' Ignore unapproved/rejected posts
	if Moderation = "Y" then
		strSql3 = strSql3 & "2"  ' Ignore unapproved posts
	else
		strSql3 = strSql3 & "3"  ' Ignore any hold posts
	end if
	strSql3 = strSql3 & ") OR T.T_AUTHOR = " & MemberID & ")"
end if
strSql7 = " GROUP BY T.TOPIC_ID"
strSql7 = strSql7 & " HAVING COUNT(R.R_AUTHOR) > -1"

strSql4 = " ORDER BY"
if strStickyTopic = "1" then
	strSql4 = strSql4 & " T.T_STICKY DESC, "
end if
if strtopicsortfld = "author" then
	strSql4 = strSql4 & " M." & strSortCol & " "
else
	strSql4 = strSql4 & " T." & strSortCol & " "
end if

if strDBType = "mysql" then 'MySql specific code
	if mypage > 1 then 
		intOffset = cLng((mypage-1) * strPageSize)
		strSql5 = strSql5 & " LIMIT " & intOffset & ", " & strPageSize & " "
	end if

	'## Forum_SQL - Get the total pagecount 
	strSql1 = "SELECT COUNT(T.TOPIC_ID) AS PAGECOUNT "

	set rsCount = my_Conn.Execute(strSql1 & strSql2 & strSql3)
	iPageTotal = rsCount(0).value
	rsCount.close
	set rsCount = nothing

	If iPageTotal > 0 then
		inttotaltopics = iPageTotal
		maxpages = (iPageTotal \ strPageSize )
		if iPageTotal mod strPageSize <> 0 then
			maxpages = maxpages + 1
		end if
		if iPageTotal < (strPageSize + 1) then
			intGetRows = iPageTotal
		elseif (mypage * strPageSize) > iPageTotal then
			intGetRows = strPageSize - ((mypage * strPageSize) - iPageTotal)
		else
			intGetRows = strPageSize
		end if
	else
		iPageTotal = 0
		inttotaltopics = iPageTotal
		maxpages = 0
	end if 

	if iPageTotal > 0 then
		set rs = Server.CreateObject("ADODB.Recordset")
		rs.open strSql & strSql2 & strSql6 & strSql3 & strSql7 & strSql4 & strSql5, my_Conn, adOpenForwardOnly, adLockReadOnly, adCmdText
			arrTopicData = rs.GetRows(intGetRows)
			iTopicCount = UBound(arrTopicData, 2)
		rs.close
		set rs = nothing
	else
		iTopicCount = ""
	end if
 
else 'end MySql specific code

	set rs = Server.CreateObject("ADODB.Recordset")
	rs.cachesize = strPageSize
	rs.open strSql & strSql2 & strSql6 & strSql3 & strSql7 & strSql4, my_Conn, adOpenStatic
		if not rs.EOF then
			rs.movefirst
			rs.pagesize = strPageSize
			inttotaltopics = cLng(rs.recordcount)
			rs.absolutepage = mypage '**
			maxpages = cLng(rs.pagecount)
			arrTopicData = rs.GetRows(strPageSize)
			iTopicCount = UBound(arrTopicData, 2)
		else
			iTopicCount = ""
			inttotaltopics = 0
		end if
	rs.Close
	set rs = nothing
end if
<

    _-/Cripto9t\-_
Go to Top of Page

tribaliztic
Senior Member

Sweden
1532 Posts

Posted - 22 December 2005 :  10:19:49  Show Profile  Visit tribaliztic's Homepage  Send tribaliztic an ICQ Message  Reply with Quote
Cool, and this version will cut down the amount of db-calls?
<

/Tribaliztic
- www.gotlandrace.se -
Go to Top of Page

cripto9t
Average Member

USA
881 Posts

Posted - 22 December 2005 :  10:44:31  Show Profile  Reply with Quote
I assume this is something like gary did.
As for the db hits, I don't know much about that stuff. But it looks like it will ;).

Gary mentioned something else, would using 1 icon be better than 11?

I'll try and get the new code to work with what I had before the days up here.<

    _-/Cripto9t\-_
Go to Top of Page

tribaliztic
Senior Member

Sweden
1532 Posts

Posted - 22 December 2005 :  10:50:11  Show Profile  Visit tribaliztic's Homepage  Send tribaliztic an ICQ Message  Reply with Quote
Okay, I'll wait alittle and see what others have to say about the db hits =)
<

/Tribaliztic
- www.gotlandrace.se -
Go to Top of Page

cripto9t
Average Member

USA
881 Posts

Posted - 23 December 2005 :  11:36:45  Show Profile  Reply with Quote
I edited the instruction post for code changes in forum.asp.
Those changes and the sql changes above have to be made for this to work.<

    _-/Cripto9t\-_
Go to Top of Page

Bassman
Junior Member

Netherlands
256 Posts

Posted - 23 December 2005 :  17:54:55  Show Profile  Visit Bassman's Homepage  Reply with Quote
Microsoft JET Database Engine error '80040e14'

Syntax error in JOIN operation.

Its not playing along with access.
<
Go to Top of Page

cripto9t
Average Member

USA
881 Posts

Posted - 24 December 2005 :  06:24:44  Show Profile  Reply with Quote
It figures :(
Its a syntax error though, so maybe it won't be a tough fix.
Thanks Bassman<

    _-/Cripto9t\-_

Edited by - cripto9t on 24 December 2005 06:25:19
Go to Top of Page

cripto9t
Average Member

USA
881 Posts

Posted - 24 December 2005 :  15:40:02  Show Profile  Reply with Quote
I managed to make the sql changes on a forum that uses ms access. It was error free. Maybe your missing a space or a comma Bassman.<

    _-/Cripto9t\-_
Go to Top of Page

Bassman
Junior Member

Netherlands
256 Posts

Posted - 24 December 2005 :  17:12:33  Show Profile  Visit Bassman's Homepage  Reply with Quote
Ok, then it is in conflict with some other mod. Not the first time this happends :) I will have a go at a clean forum and work my way up. Thanks for your input Cripo.<
Go to Top of Page
Page: of 3 Previous Topic Topic Next Topic  
Previous Page | Next Page
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.18 seconds. Powered By: Snitz Forums 2000 Version 3.4.07