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)
 Small tweak for Default.asp
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

gor
Retired Admin

Netherlands
5511 Posts

Posted - 02 February 2001 :  17:03:44  Show Profile  Visit gor's Homepage
I tweaked the Default.asp page you see used on this site a bit so that you can now link to a category or click on a category-name to display only the forums in that category.

All changes go in default.asp

At line 44 add this codeline:

intCat_ID = Request.QueryString("CAT_ID")


Change the sql-statement starting at line 80 to:

'## Forum_SQL - Get all Forums From DB
strSql = "SELECT " & strTablePrefix & "CATEGORY.CAT_ID, " & strTablePrefix & "CATEGORY.CAT_STATUS, "
strSql = strSql & strTablePrefix & "CATEGORY.CAT_NAME "
strSql = strSql & " FROM " & strTablePrefix & "CATEGORY "
if intCat_ID <> "" then
strSql = strSql & " WHERE " & strTablePrefix & "CATEGORY.CAT_ID = " & intCat_ID
end if

strSql = strSql & " ORDER BY " & strTablePrefix & "CATEGORY.CAT_NAME ASC;"


That is all that is needed to be able to filter on category, now to add the links and the "display all category" icon:

change the tableheader code starting at line 128 to:

<td align=center bgcolor="<% =strHeadCellColor %>" nowrap valign="top">
<% if intCat_ID <> "" then %>
<a href="default.asp"><img src="icon_folder.gif" height=15 width=15 border=0 hspace=0 alt="Show All Categories"></a>
<% end if %>

</td>
<td align=center bgcolor="<% =strHeadCellColor %>" nowrap valign="top"><b><font face="<% =strDefaultFontFace %>" size=".....


Note: If anyone can come up with a better icon for this, please let me know...

To make the links clickable, change the last part of line 201 to:

<a href="default.asp?CAT_ID=<%=rs("CAT_ID")%>"><font face="<% =strDefaultFontFace %>" size="<% =strDefaultFontSize %>" color="<% =strCategoryFontColor %>" valign="top"><b><% =ChkString(rs("CAT_NAME"),"display") %></a></b></font></td>


and do about the same in line 244:

Response.Write """ valign=top><a href=""default.asp?CAT_ID=" & rs("CAT_ID") & """><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """ color=""" & strCategoryFontColor & """><b>" & ChkString(rs("CAT_NAME"),"display") & "</b></font></a></td>" & vbcrlf


Ready


Known bug
Because this was a quick tweak I didn't correct the detailed statistics yet. They don't display the correct info when only 1 category is being displayed.

Pierre

Missing line-number added.... Thanks Work Mule

work mule
Senior Member

USA
1358 Posts

Posted - 02 February 2001 :  17:23:35  Show Profile
quote:

and do about the same in line :



Thanks for the mod info! Can you fill in the blank tho'? What's the very last line number you refer to?

Thanks!!

Go to Top of Page

work mule
Senior Member

USA
1358 Posts

Posted - 02 February 2001 :  17:37:45  Show Profile
Okay, I know what I'm looking for. Maybe this will help others.

Look for any instances of this:
ChkString(rs("CAT_NAME"),"display")


That code displays the Category Title. Find that bit of code and you'll find the two lines that need to be modified. This will help if you're line numbers are different than mentioned above.




Go to Top of Page

HuwR
Forum Admin

United Kingdom
20595 Posts

Posted - 02 February 2001 :  17:46:22  Show Profile  Visit HuwR's Homepage
small tweak to Gor's code

instead of just changing the code to

<a href="default.asp?CAT_ID=<%=rs("CAT_ID")%>"><font face="<% =strDefaultFontFace %>" size="<% =strDefaultFontSize %>" color="<% =strCategoryFontColor %>" valign="top"><b><% =ChkString(rs("CAT_NAME"),"display") %></a></b></font></td>


if you do

<% if intCat_ID = "" then %>
<a href="default.asp?CAT_ID=<%=rs("CAT_ID")%>"><font face="<% =strDefaultFontFace %>" size="<% =strDefaultFontSize %>" color="<% =strCategoryFontColor %>" valign="top"><b><% =ChkString(rs("CAT_NAME"),"display") %></b></font></a></td>
<% Else %>
<font face="<% =strDefaultFontFace %>" size="<% =strDefaultFontSize %>" color="<% =strCategoryFontColor %>" valign="top"><b><% =ChkString(rs("CAT_NAME"),"display") %></b></font></td>
<% End If %>


and similarly for the other occurence, this will only turn them into a link when viewing all categories, and a regular tilte when viewing a single category

'Resistance is futile'
Go to Top of Page

Huntress
New Member

USA
96 Posts

Posted - 08 February 2001 :  21:17:38  Show Profile  Visit Huntress's Homepage
quote:

and do about the same in line 244:

Response.Write """ valign=top><a href=""default.asp?CAT_ID=" & rs("CAT_ID") & """><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """ color=""" & strCategoryFontColor & """><b>" & ChkString(rs("CAT_NAME"),"display") & "</b></font></a></td>" & vbcrlf


Pierre



When using the Minimize Category Mod the above line should be modified to be:


Response.Write "<a href=""default.asp?CAT_ID=" & rs("CAT_ID") & """><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """ color=""" & strCategoryFontColor & """><b>" & ChkString(rs("CAT_NAME"),"display") & "</b></font></a></td>" & vbcrlf


Otherwise you will have " valign=top> appear on the page in front of your catagory names.

BTW... I may land up removing the Minimize Categories Mod... as that and this one don't play well together... and this one is much nicer

Thanks!

Diana

Edited by - huntress on 08 February 2001 21:18:43

Edited by - huntress on 08 February 2001 21:19:46
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 1.37 seconds. Powered By: Snitz Forums 2000 Version 3.4.07