如何使用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
投稿

猜你喜欢

  • MySql登录时闪退的快速解决办法

    2024-01-24 06:19:28
  • JMail(4.3版本)发信asp代码

    2007-08-03 12:40:00
  • python 使用OpenCV进行简单的人像分割与合成

    2021-06-16 20:46:39
  • python运行或调用另一个py文件或参数方式

    2023-10-26 02:04:47
  • Access2003:不支持这种ActiveX控件

    2010-12-09 19:59:00
  • 跟老齐学Python之dict()的操作方法

    2022-05-12 16:54:43
  • python的简单web框架flask快速实现详解

    2023-03-10 08:26:36
  • mysql 替换字段部分内容及mysql 替换函数replace()

    2024-01-23 19:25:27
  • javascript实现瀑布流自适应遇到的问题及解决方案

    2024-04-16 10:35:23
  • 解决安装mysqlclient的时候出现Microsoft Visual C++ 14.0 is required报错

    2024-01-14 15:48:14
  • golang gorm的Callbacks事务回滚对象操作示例

    2024-04-25 13:18:42
  • python 显示数组全部元素的方法

    2021-03-20 13:15:01
  • 数据库工具sysbench安装教程和性能测试例子

    2024-01-28 06:00:42
  • PyQT5 emit 和 connect的用法详解

    2022-02-08 15:15:11
  • 巧用特殊的空格字符

    2009-04-10 18:32:00
  • 用PHP编写每周签到功能以提高用户参与度

    2023-05-27 17:24:54
  • python批量提取word内信息

    2021-05-18 14:25:50
  • mysql 数据同步 出现Slave_IO_Running:No问题的解决方法小结

    2024-01-22 22:59:34
  • Mysql导入导出时遇到的问题解决

    2024-01-22 02:28:06
  • Git Bash终端默认路径的设置查看修改及拓展图文详解

    2023-08-22 02:03:40
  • asp之家 网络编程 m.aspxhome.com