菜单
/* 看到很多朋友问过无限级别菜单的的问题(其实理论上还是有级别的,毕竟要受到个方便的条件的限制,比如: 数据库字段的类型等),我曾经用老大(唠叨)提供的代码写出来过无限级别的菜单,但是感觉效果不是很好(视觉上),于是趁着"夜深人静"就写这个"无限制级别的菜单",其实道理很简单,主要是数据表的设计,还有递归方法的使用(如果有时间我会用中值排序法来做),我会在下面给出数据结构的设计(非常简单),这里我没有加上竖直的虚线(windows资源管理器的虚线),同时Sql语句我也将其固定,大家可以根据自己的需要来修改!如果有问题可以联系我:msn:banneryue@sina.com,QQ:7665656,E_mail:yuepengfei@mail.banner.com.cn
明天(已经是今天了,呵呵)我会提供一个测试页面让大家来看(因为我在宿舍只能拨号上网,Ip地址不固定)
*/
/** 递归显示子节点函数
*
*
* @param $SearchPattern 查找的条件(like)
* @param $BaseNum 节点的层数
*/
function ListChildTree($SearchPattern,$BaseNum){
global $Tree;//声明连接数据库的句柄为全局
$Sql="select DepartmentId,DepartmentName from test where DepartmentId like '$SearchPattern'"; //查找孩子节点
$QueryChild=$Tree->query($Sql);
while($Result=$Tree->fetch_array($QueryChild)) { //取出孩子节点
$Space="";
for($j=0;$j $Space.=" "; //设置显示节点前面的距离,这里的空格的html被这里自动替换成" "了
$ChildDepartment=trim($Result[0])."___";
$ChildSql="select count(*) from test where DepartmentId like '$ChildDepartment'";//查找孩子节点的孩子节点
$ChildResult=$Tree->query_first($ChildSql);
$TableId="ta".trim($Result[0]); //设置表格Id
$TablePic="ta".trim($Result[0])."pic"; //设置图片Id
if($ChildResult[0] ?>

=$Space?>![]() }//end while }//end function?> |

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Dreamweaver CS6
Visual web development tools

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

Atom editor mac version download
The most popular open source editor

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.
