I finally installed Drupal 6 tonight and came across something that nearly knocked me out. The maximum depth of the menu tree is 9 items?
Why wouldn't this number be configurable? My site is far past this since I do use Drupal to create a large directory. Who predetermined 9 layers of depth and why?
I've only found one link that said that it seems to have been an arbitrary decision so that the menutree wouldn't be too wide on a page. Well, I solved that problem long ago by throwing the menu tree out and using submenutree in Drupal 5.
So now it seems this depth was arbitrarily predetermined and there is no way in the admin settings to over-ride it meaning I will likely have to hack core to get this functionality.
Can someone tell me if I'm seeing this correctly?
Comments
Yep. Only 9 levels
I just hacked my install to up this to 15. See http://drupal.org/node/274270
Alan Davison
www.caignwebs.com.au
Alan Davison
D7 ==9 as well.
See http://drupal.org/node/274270
- www.dougvann.com
- www.twitter.com/dougvann
- Doug Vann
- http://www.dougvann.com My Blog
- http://LinkedIn.com/in/dougvann
"I've only found one link
"I've only found one link that said that it seems to have been an arbitrary decision so that the menutree wouldn't be too wide on a page."
This I don't understand. Drupal should not be restricting you for fear of breaking your layout- it should trust that you know what you are doing to make your layout capable of a large tree. If I want a menu with 50 branches- I should be able to have it no questions asked.
==============
delaware web design
delaware website design
===========
read my thoughts
Hopefully in D7
The code would take much to port to a dynamic limit. Vote to push this into D7 before the code freeze...
Alan Davison
www.caignwebs.com.au
Alan Davison
In my opinion there is no
In my opinion there is no need of extremely deep menus, a taxonomy approach (that has no depth limit) should works almost in every case. Do you need more than 9 levels for what?
I can't believe it either
But it is true. Only 9 generations for any hierarchy.
Yes, taxonomy would cope with so many generations far better, but then what is the point of having the book module? We may as well, map everything in taxonomy, shallow and deep outlines.
In our project we are building a detailed classification system and 16 generations are not uncommon. Could we do it differently with the taxonomy module? Probably. But why having the option to use book if it is not working properly?
Two options - custom menu plus taxonomy or core hack
Deep nesting is a problem, but you can generate a deep menu using either technique.
While the native menu system is denormalized, it has better performance when generating the complete menu in one hit, as it effectively is a cache of the menu tree structure. The hack mentioned above works nicely, but it doesn't update the book module. [Ignore the crap about the taxonomy menu unless you require to modify performance issues with this. ;) ] I've attached an updated Drupal 6.4 patch below.
If you want page by page stepping into the data, use a taxonomy based menu. You'll only need a singular menu item and it is fairly easy to parse the parent tid and present the children. (Eg: action/tid is enough info for most tasks)
In the project that I'm using the core hack, the primary menu is generated from a regions taxonomy. It uses one menu router row and count(terms) rows for the menu items representing the regions that are 15 levels deep. This drives 8 or so views that are attached to the taxonomy. This is presented to the user as a javascript menu.
In the same project, I also use the second approach to generate dynamic menus that allow the users to parse the same taxonomy on a per view basis. Eg: "See all xxx of this region, or narrow your search to one of the following sub-regions".
Just updating my system to 6.4, so I've attached the patch below for 15 levels, BUT IT EXCLUDES REQUIRED BOOK PATCH (probably not hard, but I never use the book module): Should work fine on clean installs (untested), or by added the extra fields to the menu_links table directly, d10 ... d15, and applying the patches.
BACKUP FIRST AND TEST WELL
Alan Davison
www.caignwebs.com.au
Alan Davison