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 DEV-Group
 DEV Discussions (General)
 Suggestion: Folder Tree Code (3.4.x)
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

pweighill
Junior Member

United Kingdom
453 Posts

Posted - 25 August 2002 :  08:40:02  Show Profile
I've written a subroutine for generating the tree navigation list shown on most pages in the forums.

Advantages of using this code are:
* If any changes to the style of the tree were required then it would only need changing in one location.
* Easier to create trees in new pages.

'Subroutine to show the branches of the navigation tree
Sub ShowTreeBranch (pintLevel, pstrIcon, pstrDescription, pstrURL)
Response.Write "<font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """>"
If pintLevel = 0 then
Response.Write getCurrentIcon(strIconFolderOpen,"","align=""absmiddle""") & " <a href=""default.asp"">All Forums</a>"
else
for iLoop = 2 to pintLevel
Response.Write "" & getCurrentIcon(strIconBlank,"","align=""absmiddle""")
next
Response.Write "" & getCurrentIcon(strIconBar,"","align=""absmiddle""")
if pstrIcon <> "" then
Response.Write getCurrentIcon(pstrIcon,"","align=""absmiddle""")
else
Response.Write getCurrentIcon(strIconFolderOpen,"","align=""absmiddle""")
end if
if pstrURL <> "" then
Response.Write " <a href=""" & pstrURL & """>" & pstrDescription & "</a>"
else
Response.Write " " & pstrDescription
end if
end if
Response.Write "</font><br />" & vbNewLine
End Sub


For example, the code to generate the tree in topic.asp would then look like:

	Response.Write	"      <table border=""0"" width=""100%"">" & vbNewLine & _
" <tr>" & vbNewLine & _
" <td width=""50%"" align=""left"" nowrap>" & vbNewLine
ShowTreeBranch 0, "", "", ""
if Cat_Status <> 0 then
strTreeIcon = strIconFolderOpen
else
strTreeIcon = strIconFolderClosed
end if
ShowTreeBranch 1, strTreeIcon, ChkString(Cat_Name,"display"), "default.asp?CAT_ID=" & Cat_ID
if ArchiveView = "true" then
strTreeIcon = strIconFolderArchived
else
if Forum_Status <> 0 and Cat_Status <> 0 then
strTreeIcon = strIconFolderOpen
else
strTreeIcon = strIconFolderClosed
end if
end if
ShowTreeBranch 2, strTreeIcon, ChkString(Forum_Subject,"display"), "forum.asp?" & ArchiveLink & "FORUM_ID=" & Forum_ID
if Request.QueryString("SearchTerms") <> "" then
strTreeText = SearchHiLite(ChkString(Topic_Subject,"title"))
else
strTreeText = ChkString(Topic_Subject,"title")
end if
if ArchiveView = "true" then
strTreeIcon = strIconFolderArchived
elseif Cat_Status <> 0 and Forum_Status <> 0 and Topic_Status <> 0 then
strTreeIcon = strIconFolderOpenTopic
else
strTreeIcon = strIconFolderClosedTopic
end if
ShowTreeBranch 3, strTreeIcon, strTreeText, ""
Response.Write "</td>" & vbNewLine


Edited by - pweighill on 25 August 2002 10:57:13

sy
Average Member

United Kingdom
638 Posts

Posted - 25 August 2002 :  10:00:13  Show Profile  Visit sy's Homepage  Send sy a Yahoo! Message
Wow, i thought you meant topic | replies > tree view code.

Good idea though, which code base 3.3 or 3.4 in title of topic would be good also if it matters.

I am playing with the topic treeview thing.

Sy

The pessimist complains about the wind; the optimist expects it to change; the realist adjusts the sails

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.12 seconds. Powered By: Snitz Forums 2000 Version 3.4.07