Using ASP to implement a Web site's directory tree
Originally wanted to translate some things out of, but recently more and more busy, later I try to paste more
The short code comes out, the translation is more and more empty to complete. Oh.
Database structure (two tables used altogether)
1. Tblcategory
Field Name Type
Root binary description tree off or on (root of directory)
ID Auto Number keyword
The sort integer identifies the integer of the field's contents (if Root is on state sort 0) indicating the order of the displayed directories
The Name text (255) can contain identifiers in HTML
HREF text (255) allows null
2. Tblpages
ID Auto Number
Sort integer keyword
Name text (255)
HREF text (255)
3.default.htm
<title>javascript Tree Control template</title>
<frameset cols= "210,*" ">
? <frame src= "tree.asp" "Name=" "TOC" >
? <frame src= "main.htm" "Name=" "Basefrm" ">
</frameset>
4.main.htm
<body>
</body>
5.tree.asp
Set conn = Server.CreateObject ("" ADODB. Connection "")
Set Rs = Server.CreateObject ("" ADODB. Recordset "")
Conn.Open "" Driver=microsoft Access DRIVER (*.mdb);D bq= "" & Server.MapPath ("Toc.mdb")
strSQL = "" Select Tblcategory.root, Tblcategory. [ID], tblcategory.sort as Catsort, Tblpages.sort as Linksort, Tblcategory. [Name] As CatName, tblcategory.href as Caturl, Tblpages. [Name] As Linkname, tblpages.href as Linkurl from Tblcategory left JOIN tblpages on Tblcategory. [ID] = tblpages. [ID] ORDER by Tblcategory.root ASC, Tblcategory.sort, Tblpages.sort ""
Rs.Open strSQL, Conn, 2, 2
If not rs.eof then Rs.movefirst
CurrentID = "" "%>
<link rel= "stylesheet" "href=" "Ftie4style.css" ">
<!--infrastructure code for the-->
<script src= "Ftiens4.js" "></script>
<!--Execution of the code that actually builds the specific tree-->
<script>
Usetextlinks = 1
<%
Do as not rs.eof
If Rs ("" "Root") = True Then%>
Folderstree = Gfld ("" <%= rs ("CatName")%> "", "" <%= rs ("" Caturl ")%>" ")
<% Else%>
Aux1 = INSFLD (Folderstree, Gfld ("<%= rs (" "CatName")%> "", "" <%= rs ("" Caturl ")%>"))
<% CurrentID = Rs ("ID")
Savedid = Rs ("ID")
Do While CurrentID = Savedid and not rs.eof
If Rs ("Linkname") <> "" "Then%>
Insdoc (Aux1, Glnk (0, "" <%= rs ("" Linkname ")%>" "," "<%= rs (" "Linkurl")%> "")
<%
End If
Rs.movenext
If not rs.eof then CurrentID = rs ("ID")
Loop
End If
If CurrentID = "" "Then Rs.movenext
Loop%>
</script>
<script>
Initializedocument ()
</script>
<base target= "Basefrm" ">
<title></title>
<body bgcolor= "White" >
</body>