How to make a tree-style menu structureIn order to make a tree-style structure that does not have (almost) any limits to width and length, you need to create an index that allocates a certain hierarchy:LEVEL - ITEM 001 - Folder 1 002 - Folder 2 003 - Folder 3 ... 235 - Folder 235 And for the "subfolders" 001001 Subfolder 1 of Folder 1 001002 etc ... Assuming that you will write those entries into a table, and want to open one specific item in the tree, you will need to display certain other folders also in order to get a correct layout. For calling entry 001002, the SQL-Structure for this would be (PHP example): ($strlen is the stringlength of "001002", 6) $sql="SELECT * FROM yourtable WHERE ((SUBSTRING(level,1,$strlen)='001002') AND (LENGTH(level)=$strlen+3)) ";(".=" concatenates strings in PHP, please find your appropriate syntax.) The first WHERE ((...) AND (...)) gets all subfolders of the level. Then you take each 3-digit-portion of the level and open all its first-level parallel folders. This causes that you can see all direct subfolders of level 001 always while opening 001001 and those below. The limits of this operation are clear: 1. you can have only 999 subfolders in each folder, but then again 999 in those. If you want more, change the structure to 0001 and exchange all "3" by "4" in the text above. 2. There is a limit to length of SQL statements in many servers. If the level becomes too deep, the SQL statement cannot be parsed anymore. Then you need to make separate queries while the levels are displayed to split the load. Last Update: 2004-10-18 17:48:19 FAQ > Programming
> General
Recent Aditions- I have "sh: host: command not found" in my logfiles! (2008-01-10 09:13:35)- My driverless USB device is not recognized! (2007-09-19 10:20:12) - How to zip all logfiles recursive (2007-09-14 10:19:50) - Please add currency X to the charts! (2006-11-17 15:28:04) - How do I re-emerge my packages after changing my useflags in mage.conf? (2006-10-22 11:35:24) - Ghost Recon Advanced warfighter (GRAW), SECUROM & Kaspersky Anti-Virus (2006-09-17 09:35:27) - I get a message "This layout sucks. Adapt squirrelmail.css!!!" below my Message list! (2006-06-23 13:31:11) - How can I remove my old kernel sources? (2006-06-09 11:35:22) - How can I find out how much space a directory is using? (2006-06-09 10:57:22) - How can I start VNCServer on Fedora to start automatically for a certain user as a daemon? (2006-05-31 09:40:25) Most wanted FAQ- ATI Catlayst driver: CLI.exe - does not start (8982)- I upgraded to FC4 and now I get a "Cannot open/read repomd.xml file for repository: livna-stable" (6753) - How to setup rotating logs with "Rotatelogs" under Windows (5416) - Shut Down and Automatic Reboot Problems (3738) - How can I start VNCServer on Fedora to start automatically for a certain user as a daemon? (3368) - How to unzip many files to their respective directories under Linux? (3153) - How to convert a complete Database to Unicode (UTF-8), using Windows. (3063) - How can I terminate a program? (2672) - How to make a tree-style menu structure (2657) - How can I find out what processes are running in the background? (2430) |
| Copyright © 2008 Tokyoahead All trademarks and copyrights on this page are owned by their respective owners. |
![]() This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 License. |
Powered By Geeklog Created this page in 0.30 seconds |