如何使用ASP实现网站的“目录树”管理

来源:CSDN 时间:2008-06-13 06:39:00 

使用ASP实现网站的目录树

数据库结构(共使用了两个表)

1。tblCategory
字段名  类型  
Root   binary   说明树关或开(目录的根)
ID     自动编号 关键字
Sort   integer  识别该字段内容的整数(如果root是开状态sort为0)表示显示的目录的顺序
Name   text(255)可以包含html中的标识符
HREF   text(255) 允许空

2。tblPages
ID   自动编号
Sort  integer 关键字
Name  text(255)
HREF  text(255)

3.default.htm

<html>
<head>
<title>JavaScript Tree Control Template</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>Start Page</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 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 = """" %>
<html>
<head>
<link rel=""stylesheet"" href=""ftie4style.css"">
<!-- Infrastructure code for the tree -->
<script src=""ftiens4.js""></script>
<!-- Execution of the code that actually builds the specific tree -->
<script>
USETEXTLINKS = 1
<%
    Do While 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>
</head>
<body bgcolor=""white"">
</body>
</html>


 



标签:树,目录,asp
0
投稿

猜你喜欢

  • ASP中的面向对象类

    2011-04-11 10:34:00
  • 用玩票的心态瞎猜豆瓣的思路

    2008-08-18 21:14:00
  • XPath 11个实例

    2008-09-05 15:06:00
  • 实例剖析:MySQL数据库优化详解

    2008-11-22 12:19:00
  • asp实现本周的一周时间列表的代码

    2011-04-06 10:45:00
  • js游戏 俄罗斯方块 源代码

    2008-01-24 13:14:00
  • 科讯CMS 5.0 模板标签清单列表

    2008-12-04 13:18:00
  • JavaScript Dom编程:介绍学习书籍

    2008-02-20 08:32:00
  • 滑动门代码 兼容IE7 IE6 FireFox Opera

    2008-06-07 13:56:00
  • javascript闭包的秘密

    2008-09-28 20:39:00
  • WEB页面工具语言XML带来的好处

    2008-05-29 11:01:00
  • Microsoft SQL Server数据库开发问题详解

    2009-10-23 14:16:00
  • SQL Server数据库于应用程序的关系

    2010-07-26 14:21:00
  • PL/SQL数据类型及操作符

    2009-02-26 11:17:00
  • 八种获取当前日期的js代码

    2007-09-07 10:26:00
  • 设计师的职业规划

    2009-08-31 12:52:00
  • 合并SQL脚本文件的方法分享

    2011-09-30 11:13:03
  • asp如何定时执行约定的页面?

    2009-11-15 20:17:00
  • asp,php 和 jsp 比较 之我见

    2007-08-10 13:35:00
  • 交互设计实用指南系列(5) – 突出重点,一目了然

    2010-01-11 21:05:00
  • asp之家 网络编程 m.aspxhome.com