Unlimited menu implementation
Tomorrow (today, huh, huh) I will provide a test page for you to see (because I can only dial up the Internet in the dormitory and the IP address is not fixed)
*/
/** Recursively display subnode functions
*
*
* @ Param $ search condition (like)
* @ Param $ number of layers of the BaseNum node
*/
Function ListChildTree ($ SearchPattern, $ BaseNum ){
Global $ Tree; // declare that the database connection handle is global.
$ SQL = "select DISTINCT mentid, DepartmentName from test where distinct mentid like '$ SearchPattern'"; // search for child nodes
$ QueryChild = $ Tree-> query ($ SQL );
While ($ Result = $ Tree-> fetch_array ($ QueryChild) {// retrieve the child node
$ Space = "";
For ($ j = 0; $ j <(strlen ($ SearchPattern)/3)-$ BaseNum); $ j ++)
$ Space. = ""; // set the distance before the display node. here, the Space html is automatically replaced ""
$ ChildDepartment = trim ($ Result [0]). "___";
$ ChildSql = "select count (*) from test where perform mentid like '$ ChildDepartment'"; // you can find the child node of a child node.
$ ChildResult = $ Tree-> query_first ($ ChildSql );
$ TableId = "ta". trim ($ Result [0]); // you can specify a table Id.
$ TablePic = "ta". trim ($ Result [0]). "pic"; // set the image Id
If ($ ChildResult [0] <1) {// if the node of the child node is not found, the "-" image is displayed.
?>
"Class =" F1 ">
?>
',' ') "Style =" cursor: hand ">" src = "parent.gif" border = "0" align = "absmiddle" width = "35" height = "17"> "class =" F1 ">
ListChildTree ($ ChildDepartment, $ BaseNum); // recursively call the function itself to display other child nodes} // End if?>
} // End function?>
Unlimited menu test
|