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)
 Minimizing Categories
 New Topic  Topic Locked
 Printer Friendly
Next Page
Author Previous Topic Topic Next Topic
Page: of 8

davemaxwell
Access 2000 Support Moderator

USA
3020 Posts

Posted - 08 August 2000 :  10:03:53  Show Profile  Visit davemaxwell's Homepage  Send davemaxwell an AOL message  Send davemaxwell an ICQ Message  Send davemaxwell a Yahoo! Message
This code allows a user to "minimize" a category. This is a variation of the one I found at vBulletin, but I think it's pretty unique.

Basically if you have:
Category1
ForumA
ForumB
ForumC
Category2
ForumD
ForumE
Category3
ForumF
ForumG

And you click on Category2, you will then get:
Category1
ForumA
ForumB
ForumC
Category2
Category3
ForumF
ForumG

Click on Category1 and you will get:
Category1
Category2
Category3
ForumF
ForumG

Click on Category2 again and you will get:
Category1
Category2
ForumD
ForumE
Category3
ForumF
ForumG

The coding also stores your category choices in a cookie so it will show up the same way the next time you come back
to the page.

The code is all in default.asp and is pretty simple:

Between the include inc_functions.asp line and the include inc_top.asp line, add the following code:

<%
strSql = "Select Max(" & strTablePrefix & "CATEGORY.CAT_ID) as Max_ID "
strSql = strSql & " FROM " & strTablePrefix & "CATEGORY"
set rs0 = my_Conn.Execute (StrSql)

MaxID = rs0("MAX_ID")
rs0.close
set rs0 = nothing

If MaxID > 0 then
i = 1
do until i > cint(MaxID)
HideForumCat = "HideCat" & i
If Request.QueryString(HideForumCat) = "Y" then
Response.Cookies(HideForumCat) = "Y"
Response.Cookies(HideForumCat).Expires = dateAdd("d", 30, strForumTimeAdjust)
Else
If Request.QueryString(HideForumCat) = "N" then
Response.Cookies(HideForumCat) = "N"
Response.Cookies(HideForumCat).Expires = dateAdd("d", 30, strForumTimeAdjust)
End If
End If
i = i + 1
loop
end if
scriptname = request.servervariables("script_name")
%>


Do a find on =chkString(rs("CAT_NAME"),"display") (about line 142) and replace that line with this code:

<td bgcolor="<% =strCategoryCellColor %>" colspan="<% if (strShowModerators = "1") or (mlev = 3 or mlev = 4) then if mlev = 3 then Response.Write("7") else Response.Write("6") end if else Response.Write("5") end if%>">
<% ' This code will specify whether or not to show the forums under a category
HideForumCat = "HideCat" & rs("Cat_ID")
If Request.Cookies(HideForumCat) = "Y" then %>
<% if (InStr(1, ScriptName, "default.asp", 1)) then %>
<a href="<% =ScriptName & "?" %><% =HideForumCat & "=N" %>">
<% else %>
<a href="<% =ScriptName & "default.asp?" %><% =HideForumCat & "=N" %>">
<% end if %>
<% Else %>
<% if (InStr(1, ScriptName, "default.asp", 1)) then %>
<a href="<% =ScriptName & "?" %><% =HideForumCat & "=Y" %>">
<% else %>
<a href="<% =ScriptName & "default.asp?" %><% =HideForumCat & "=Y" %>">
<% end if %>
<font face="<% =strDefaultFontFace %>" size="<% =strDefaultFontSize %>" color="<% =strCategoryFontColor %>" size"+1"><% =ChkString(rs("CAT_NAME"),"display") %></font></A></td>


Right after the Do a find on ChkDisplayHeader = false(about line 152). Before the next <tr>, add the following line:
<%     if Request.Cookies(HideForumCat) <> "Y" then %>


Right before the rsForum.movenext, add the following line:
[<%		end if %>



That's it for the minimizing of Categories!!!

Let me know if you have any questions or comments....

Dave Maxwell
--------------
Self Certified Snitz Bug Swatter

Edited by - davemaxwell on 08 August 2000 14:57:28

Sparty
Starting Member

USA
45 Posts

Posted - 08 August 2000 :  13:04:04  Show Profile  Send Sparty an AOL message  Send Sparty an ICQ Message
Would be interesting to see if on the forum, to judge how it would work.



Sparty
-----------------------

She turned me into a Newt..

A Newt?

I got betta!
Go to Top of Page

Nathan L
New Member

USA
83 Posts

Posted - 08 August 2000 :  13:55:38  Show Profile  Send Nathan L an AOL message  Send Nathan L an ICQ Message  Send Nathan L a Yahoo! Message
There's a problem with the following line:
<pre id=code><font face=courier size=2 id=code><a href="<% =ScriptName & "default.asp?" %><% =HideForumCat & "=N" %></font id=code></pre id=code> first of all, it's lacking the closing part of the </A> tag and furthermore, the url is coming out as (for example) http://forum.snitz.com/forum/default.aspdefault.asp?HideCat2=Y

Response.Write ("The Reign of Nice")
Go to Top of Page

Nathan L
New Member

USA
83 Posts

Posted - 08 August 2000 :  13:58:50  Show Profile  Send Nathan L an AOL message  Send Nathan L an ICQ Message  Send Nathan L a Yahoo! Message
Those url lines should actually be:
<pre id=code><font face=courier size=2 id=code><a href="<% =ScriptName & "?" %><% =HideForumCat & "=N" %>"></font id=code></pre id=code>and<pre id=code><font face=courier size=2 id=code><a href="<% =ScriptName & "?" %><% =HideForumCat & "=Y" %>"></font id=code></pre id=code>

Response.Write ("The Reign of Nice")
Go to Top of Page

davemaxwell
Access 2000 Support Moderator

USA
3020 Posts

Posted - 08 August 2000 :  14:01:32  Show Profile  Visit davemaxwell's Homepage  Send davemaxwell an AOL message  Send davemaxwell an ICQ Message  Send davemaxwell a Yahoo! Message
Sparty: check out www.keystonecapitalchorus.org/forum to see it in action.

Nate: The </a> is at the end of the rs("CAT_NAME") line.

As for the scriptname, sorry about that. My site is set up to use default.asp as a base file. If I go to
www.keystonecapitalchorus.org/forum and I do a request.servervariable("SCRIPT_NAME"), I don't get default.asp at all.
I will have to edit that to fix it. Thanks...

Dave Maxwell
--------------
Self Certified Snitz Bug Swatter <img src=icon_smile_big.gif border=0 align=middle>


Edited by - davemaxwell on 08 August 2000 14:40:28
Go to Top of Page

davemaxwell
Access 2000 Support Moderator

USA
3020 Posts

Posted - 08 August 2000 :  14:30:57  Show Profile  Visit davemaxwell's Homepage  Send davemaxwell an AOL message  Send davemaxwell an ICQ Message  Send davemaxwell a Yahoo! Message
This code should work for everyone. Please replace:
<pre id=code><font face=courier size=2 id=code>
<% If Request.Cookies(HideForumCat) = "Y" then %>
<a href="<% =ScriptName & "default.asp?" %><% =HideForumCat & "=N" %>
<% Else %>
<a href="<% =ScriptName & "default.asp?" %><% =HideForumCat & "=Y" %>
<% End If %>
</font id=code></pre id=code>

with
<pre id=code><font face=courier size=2 id=code>
<% If Request.Cookies(HideForumCat) = "Y" then %>
<% if (InStr(1, ScriptName, "default.asp", 1)) then %>
<a href="<% =ScriptName & "?" %><% =HideForumCat & "=N" %>
<% else %>
<a href="<% =ScriptName & "default.asp?" %><% =HideForumCat & "=N" %>
<% end if %>
<% Else %>
<% if (InStr(1, ScriptName, "default.asp", 1)) then %>
<a href="<% =ScriptName & "?" %><% =HideForumCat & "=Y" %>
<% else %>
<a href="<% =ScriptName & "default.asp?" %><% =HideForumCat & "=Y" %>
<% end if %>
<% End If %>
</font id=code></pre id=code>


I will fix the code above....

Dave Maxwell
--------------
Self Certified Snitz Bug Swatter <img src=icon_smile_big.gif border=0 align=middle>

Edited by - davemaxwell on 08 August 2000 14:38:31

Edited by - davemaxwell on 08 August 2000 14:48:31
Go to Top of Page

Nathan L
New Member

USA
83 Posts

Posted - 08 August 2000 :  14:39:34  Show Profile  Send Nathan L an AOL message  Send Nathan L an ICQ Message  Send Nathan L a Yahoo! Message
No, what I mean, Dave, is that you're not closing the end of the initial <a href...> tag. You're forgetting <b><font color=red>"></font id=red></b>.

Response.Write ("The Reign of Nice")

Edited by - Nathan L on 08 August 2000 14:41:07
Go to Top of Page

davemaxwell
Access 2000 Support Moderator

USA
3020 Posts

Posted - 08 August 2000 :  14:50:12  Show Profile  Visit davemaxwell's Homepage  Send davemaxwell an AOL message  Send davemaxwell an ICQ Message  Send davemaxwell a Yahoo! Message
DOH! You're right!!!! I'll fix the top code AGAIN(sigh....)

Dave Maxwell
--------------
Self Certified Snitz Bug Swatter <img src=icon_smile_big.gif border=0 align=middle>
Go to Top of Page

slemieux
Junior Member

USA
234 Posts

Posted - 08 August 2000 :  19:23:57  Show Profile
Thanks Dave!!!
I added plus/minus graphics and took out the link on the Category Title simply by changing the lines
<a href="<% =ScriptName & "?" %><% =HideForumCat & "=N" %>">[img]plus.gif" width="10" height="10" border="0"></a>
<a href="<% =ScriptName & "?" %><% =HideForumCat & "=N" %>">[img]minus.gif" width="10" height="10" border="0"></a>

This should hopefully make it less confusing for new people and leave the topic link open for a future mod of clicking on the Category and having it display just that Category.

Thanks again <img src=icon_smile.gif border=0 align=middle>

Go to Top of Page

RichardKinser
Snitz Forums Admin

USA
16655 Posts

Posted - 09 August 2000 :  16:09:38  Show Profile
I have yet to get this working.

The error I am getting right now is:

Microsoft VBScript runtime error '800a01a8'

Object required: 'my_Conn'

/dssdbs/forum/Default.asp, line 35


Line 35 reads:

<pre id=code><font face=courier size=2 id=code>
set rs0 = my_Conn.Execute (strSql)
</font id=code></pre id=code>

When I did the search for <font color=red>=chkString(rs("CAT_NAME"),"display")</font id=red> I get 2 lines with this string. I changed the second one. Should I change the first one as well?

Also I am assuming that the <b>[</b> in front of <% end if %> is a typo.

Thanks! :)

Go to Top of Page

animedj
Junior Member

USA
190 Posts

Posted - 09 August 2000 :  16:51:25  Show Profile  Visit animedj's Homepage  Send animedj an ICQ Message
hmm a fix for that is to add the line that goes between inc_function.asp and inc_top.asp after inc_top.asp but then you would also need to add <% response.buffer = true %> at the very top fo your page (#1 line) so it can work properly.

Go to Top of Page

RichardKinser
Snitz Forums Admin

USA
16655 Posts

Posted - 09 August 2000 :  16:59:55  Show Profile
Thanks, that fixed it. I wonder why I had that problem and others haven't...

Go to Top of Page

Lord Maverick
New Member

Norway
92 Posts

Posted - 09 August 2000 :  17:57:27  Show Profile  Send Lord Maverick an ICQ Message
It would be nice if someone could post the final working code in one post... I find it a bit hard to keep the thread here..

Go to Top of Page

Kal Corp
Average Member

USA
878 Posts

Posted - 09 August 2000 :  22:28:02  Show Profile  Visit Kal Corp's Homepage
Are all the mods going to show up in the next testing?

and when is that Coming?

Testing forums - 2 Forums same database + mod's
http://vasserver.dyndns.org/forums_2000/forum1/default.asp
Go to Top of Page

slemieux
Junior Member

USA
234 Posts

Posted - 09 August 2000 :  23:12:56  Show Profile
<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote>
Are all the mods going to show up in the next testing?
and when is that Coming?
<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>

My quess would be definatly not until after the 15th and the mods will be added at Mike's discretion (geez I need a spellchecker - lol)

Lord Maverick, I took Dave's code and added it to a text file to make it easier for everyone.
Please note: This is Dave's code and all questions, suggestions and <font color=red><b>BIG pats on the back </b></font id=red>should go to him <img src=icon_smile.gif border=0 align=middle>

You can view it here http://209.35.175.12/snitz/minimizecat.txt

And let me know if I screwed it up anywhere!

Scott LeMieux

Edited by - slemieux on 09 August 2000 23:13:35
Go to Top of Page

Kal Corp
Average Member

USA
878 Posts

Posted - 09 August 2000 :  23:42:48  Show Profile  Visit Kal Corp's Homepage
dave FYI just download and tested.

had to add

set my_Conn = Server.CreateObject("ADODB.Connection")
my_Conn.Open strConnString

to start of code to get it to work?

Testing forums - 2 Forums same database + mod's
http://vasserver.dyndns.org/forums_2000/forum1/default.asp

Edited by - kal corp on 10 August 2000 00:28:17
Go to Top of Page
Page: of 8 Previous Topic Topic Next Topic  
Next Page
 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.19 seconds. Powered By: Snitz Forums 2000 Version 3.4.07