ASP를 사용하여 웹 사이트의 디렉토리 트리 구현
데이터베이스 구조 (2 개의 테이블이 총 사용됨)
1. TBLCATEGORY
필드 이름 유형
루트 바이너리 설명 트리 닫기 또는 열기 (디렉토리의 루트)
ID 자동 번호 매기기 키워드
Sort Integer 필드가 포함 된 정수를 인식합니다 (루트가 열린 경우 정렬은 0입니다)는 표시된 디렉토리의 순서를 나타냅니다.
이름 텍스트 (255)는 HTML에 식별자를 포함 할 수 있습니다
Href Text (255)는 비어 있습니다
2. tblpages
ID 자동 번호 매기기
정수 키워드를 정렬하십시오
이름 텍스트 (255)
HREF 텍스트 (255)
3.default.htm
<html>
<헤드>
<title> JavaScript 트리 제어 템플릿 </title>
</head>
<frameset cols = ""210,*"">
? <frame src = ""tree.asp ""name = ""toc "">
? <frame src = ""main.htm ""name = ""basefrm "">
</frameset>
</html>
4.main.htm
<head> <title> </title> </head>
<body>
<H2> 시작 페이지 </h2>
</body>
</html>
5.tree.asp
set conn = server.createobject ( ""adodb.connection "")
set rs = server.createobject ( ""adodb.recordset "")
conn.open ""Driver = Microsoft Access Driver (*.mdb); dbq = ""& server.mappath ( ""toc.mdb "")
strsql = ""select tblcategory.root, tblcategory. [id], tblcategory.sort로 catsort, tblpages.sort, tblcategory. tblcategory. [id] = tblpages. [id] tblcategory.root asc, tblcategory.sort, tblpages.sort "의 주문
Rs. OPEN STRSQL, CONN, 2, 2
rs.eof가 아니라면 rs.movefirst
currentId = "" "" %>
<html>
<헤드>
<link rel = ""스타일 시트 ""href = ""ftie4style.css "">
<!-트리의 인프라 코드->
<script src = ""ftiens4.js ""> </script>
<!-실제로 특정 트리를 빌드하는 코드 실행->
<cript>
USETEXTLINKS = 1
<%
rs.eof가 아니라
rs ( ""root "") = true then %> 인 경우
폴더 스트리 = gfld ( ""< %= rs ( "" "" "catname" ") %>" "," "< %= rs (" ""caturl "") %> "" ")
< % else %>
aux1 = insfld (폴더 스트리, gfld ( ""< %= rs ( "" "catname" ") %>" ","< %= rs ( "" "") %> ""))))
<% currentId = rs ( ""id "")
savedid = rs ( ""id "")
currentID = saveDID가 아니라 rs.eof가 아닙니다
rs ( ""int
insdoc (aux1, glnk (0, ""< %= rs ( ""linkname "") %> "", ""< %= rs ( "" "linkurl" ") %>")))))