最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
一段无限级菜单代码
时间:2022-06-30 11:22:55 编辑:袖梨 来源:一聚教程网
//boardid 文章ID(自动增长) parentid 父级ID 默认为0 (0代表最高级) boardtype 菜单名. 其它字段省
----------------------------------------------
| boardid | type | parentid | ----------------------------------------------
核心代码:
//先取出最高级(parentid=0)的分类
<%
set rs1=server.createobject("adodb.recordset")
sql1="select * from board where parentid=0 order by id"
rs1.open sql1,conn,1,1
if rs1.eof or rs1.bof then
response.write"还没论坛分类!"
else
while not rs1.eof
id1=rs1("id")
type1=rs1("boardtype")
parentid1=rs1("parentid")
call recursion(id1,type1,parentid1)
rs1.movenext
wend
end if
rs1.close
set rs1=nothing
%>
<%
sub recursion(id,m_boardtype,m_parentid)
'递归调用函数,生成一个类别代码
set rs=server.createobject("adodb.recordset")
sql="select * from board where parentid="&id
rs.open sql,conn,1,1
while not rs.eof
id0=rs("id")
type0=rs("boardtype")
parentid0=rs("parentid")
call recursion(id0,type0,parentid0)
rs.movenext
wend
rs.close
set rs=nothing
%>
----------------------------------------------
| boardid | type | parentid | ----------------------------------------------
核心代码:
//先取出最高级(parentid=0)的分类
<%
set rs1=server.createobject("adodb.recordset")
sql1="select * from board where parentid=0 order by id"
rs1.open sql1,conn,1,1
if rs1.eof or rs1.bof then
response.write"还没论坛分类!"
else
while not rs1.eof
id1=rs1("id")
type1=rs1("boardtype")
parentid1=rs1("parentid")
call recursion(id1,type1,parentid1)
rs1.movenext
wend
end if
rs1.close
set rs1=nothing
%>
<%
sub recursion(id,m_boardtype,m_parentid)
'递归调用函数,生成一个类别代码
set rs=server.createobject("adodb.recordset")
sql="select * from board where parentid="&id
rs.open sql,conn,1,1
while not rs.eof
id0=rs("id")
type0=rs("boardtype")
parentid0=rs("parentid")
call recursion(id0,type0,parentid0)
rs.movenext
wend
rs.close
set rs=nothing
%>
相关文章
- boss智能门锁如何设置密码 04-29
- 王者荣耀世界橘右京厉害吗 04-29
- 《青云劫攻略天赋技能,成就无敌仙侠》(解锁潜能,掌握绝学,成就仙侠传奇) 04-29
- 桃源深处有人家藏经室悟证一至七日通关答案 04-29
- 怎么击败《Saros》中的“破碎崛起”先知 Boss 04-29
- 宫小攻略技能推荐2023(玩转宫小,轻松游戏攻略指南) 04-29