转至繁体中文版     | 网站首页 | 图文教程 | 资源下载 | 站长博客 | 图片素材 | 武汉seo | 武汉网站优化 | 
最新公告:     敏韬网|教学资源学习资料永久免费分享站!  [mintao  2008年9月2日]        
您现在的位置: 学习笔记 >> 图文教程 >> 站长学院 >> Web开发 >> 正文
用ASP实现网站的“目录树”管理         ★★★★

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

作者:闵涛 文章来源:闵涛的学习笔记 点击数:733 更新时间:2009/4/23 10:25:28

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

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$#@62;
〈head$#@62;
〈title$#@62;JavaScript Tree Control Template〈/title$#@62;
〈/head$#@62;
〈frameset cols="210,*"$#@62;
?〈frame src="tree.asp" name="TOC"$#@62;
?〈frame src="main.htm" name="basefrm"$#@62;
〈/frameset$#@62;
〈/html$#@62;

4.main.htm
〈head$#@62;〈title$#@62;〈/title$#@62;〈/head$#@62;
〈body$#@62;
〈h2$#@62;Start Page〈/h2$#@62;
〈/body$#@62;
〈/html$#@62;

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 = "" %$#@62;
〈html$#@62;
〈head$#@62;
〈link rel="stylesheet" href="ftie4style.css"$#@62;
〈!-- Infrastructure code for the tree --$#@62;
〈script src="ftiens4.js"$#@62;〈/script$#@62;
〈!-- Execution of the code that actually builds the specific tree --$#@62;
〈script$#@62;
USETEXTLINKS = 1
〈%
D hile Not Rs.EOF
If Rs("Root") = True Then %$#@62;
foldersTree = gFld("〈%= Rs("CatName") %$#@62;", "〈%= Rs("CatURL") %$#@62;")
〈% Else %$#@62;
aux1 = insFld(foldersTree, gFld("〈%= Rs("CatName") %$#@62;", "〈%= Rs("CatURL") %$#@62;"))
〈% currentID = Rs("ID")
savedID = Rs("ID")
Do While currentID = savedID and not rs.eof
if Rs("LinkName") 〈$#@62; "" Then %$#@62;
insDoc(aux1, gLnk(0, "〈%= Rs("LinkName") %$#@62;", "〈%= Rs("LinkURL") %$#@62;"))
〈%
end if
Rs.MoveNext
if not rs.eof then currentID = Rs("ID")
Loop
End If
if currentID = "" then rs.movenext
Loop %$#@62;
〈/script$#@62;
〈script$#@62;
initializeDocument()
〈/script$#@62;
〈base target="basefrm"$#@62;
〈title$#@62;〈/title$#@62;
〈/head$#@62;
〈body bgcolor="white"$#@62;
〈/body$#@62;
〈/html$#@62;


没有相关教程
教程录入:mintao    责任编辑:mintao 
  • 上一篇教程:

  • 下一篇教程:
  • 【字体: 】【发表评论】【加入收藏】【告诉好友】【打印此文】【关闭窗口
      注:本站部分文章源于互联网,版权归原作者所有!如有侵权,请原作者与本站联系,本站将立即删除! 本站文章除特别注明外均可转载,但需注明出处! [MinTao学以致用网]
      网友评论:(只显示最新10条。评论内容只代表网友观点,与本站立场无关!)

    同类栏目
    · Web开发  · 网页制作
    · 平面设计  · 网站运营
    · 网站推广  · 搜索优化
    · 建站心得  · 站长故事
    · 互联动态
    更多内容
    热门推荐 更多内容
  • 没有教程
  • 赞助链接
    更多内容
    闵涛博文 更多关于武汉SEO的内容
    500 - 内部服务器错误。

    500 - 内部服务器错误。

    您查找的资源存在问题,因而无法显示。

    | 设为首页 |加入收藏 | 联系站长 | 友情链接 | 版权申明 | 广告服务
    MinTao学以致用网

    Copyright @ 2007-2012 敏韬网(敏而好学,文韬武略--MinTao.Net)(学习笔记) Inc All Rights Reserved.
    闵涛 投放广告、内容合作请Q我! E_mail:admin@mintao.net(欢迎提供学习资源)

    站长:MinTao ICP备案号:鄂ICP备11006601号-18

    闵涛站盟:医药大全-武穴网A打造BCD……
    咸宁网络警察报警平台