& Lt ;? & Nbsp;/* Many friends have asked questions about unlimited menu levels (in theory, there are still some levels. after all, they are subject to convenient conditions, such: database field type). I used the code provided by the boss (nagging) to write an unlimited menu, but the effect is not very good (depending on SyntaxHighlighter. all (
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"; // find a child node
$ 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 locate mentid like $ ChildDepartment"; // you can find the child node of the 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.
?>
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service