How to use ASP to implement the Web site's "Directory Tree" management

Source: Internet
Author: User
Tags implement integer sort
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>



Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.