In case you are interested (or anyone else for that matter), the forum I was thinking of was at http://www.magicmushroom.org.uk/forum/default.asp. Click on a category and it shows only that category.
This was not quite what I wanted, as if you go into a topic within that category and then click the all forums link to go back up, it will show all of the categories again. This is not necessarily wrong, it's just not what I wanted.
So I modified my version to store the displayed category as a cookie, so if you go back to default.asp, it still shows only the required category. Passing a CAT_ID of -1 resets the view to display all categories.
If you're still interested, the changes I did to make this happen are:
Add the follwing towards the top of the code:
'################# Category filtering
intCat_ID = Request.QueryString("CAT_ID")
if intCat_ID = "" then
'check for cookie value
intCat_ID = Request.Cookies(strUniqueID & "CATID")
end if
if intCat_ID = "-1" then
'clear the cookie
Response.Cookies(strUniqueID & "CATID") = ""
intCat_ID = ""
else
'set the cookie
Response.Cookies(strUniqueID & "CATID") = intCat_ID
Response.Cookies(strUniqueID & "CATID").Expires = dateAdd("d", 30, strForumTimeAdjust)
End If
'################# End Category filtering
Change the following code:
strSql = "SELECT " & strTablePrefix & "CATEGORY.CAT_ID, " & strTablePrefix & "CATEGORY.CAT_STATUS, "
strSql = strSql & strTablePrefix & "CATEGORY.CAT_NAME "
strSql = strSql & " FROM " & strTablePrefix & "CATEGORY "
strSql = strSql & " ORDER BY " & strTablePrefix & "CATEGORY.CAT_NAME ASC;"
to:
strSql = "SELECT " & strTablePrefix & "CATEGORY.CAT_ID, " & strTablePrefix & "CATEGORY.CAT_STATUS, "
strSql = strSql & strTablePrefix & "CATEGORY.CAT_NAME "
strSql = strSql & " FROM " & strTablePrefix & "CATEGORY "
'################# End Category filtering
if intCat_ID <> "" then
strSql = strSql & " WHERE " & strTablePrefix & "CATEGORY.CAT_ID = " & intCat_ID
end if
'################# End Category filtering
strSql = strSql & " ORDER BY " & strTablePrefix & "CATEGORY.CAT_NAME ASC;"
Now to have links to specific categories you just need to have a link to default.asp?CAT_ID=<cat number>, and for all categories default.asp?CAT_ID=-1.
Note that the site I referred to, allows you to click on the categories, as well as providing an icon to jump back to the "all-category" display. I didn't require this, but it would be easy enough to incorporate the 2 together.
Kym.