Adrian Rossouw wrote:
Oddly enough, i harbour no love for multi-dimensional arrays =)
I do however think this is one of the cases where they will actually provide a more natural access method to the data they contain.
For instance, if you want to get all the child pages for node , you can just cycle through $menu['node'], and print all the children that have 'item' elements.
Same with drawing the local tasks.
Maybe really good documentation would make it easier to grok.
I just think that using a tree to store a .. you know.. tree, results in clearer, and easier to debug code.
I certainly agree with that. But I usually think of trees as being, well, trees, with pointers to parents and children. You've cleverly mapped this onto multidimensional arrays. I tend to think of trees as having 2 dimensions, depth and breadth. I guess my brain is dimensionally challenged. :-)
1. it is slow -- we had to add menu caching, but even with caching it is slow.
If Adrian's scheme can improve performance, I'd be all for it. I'd still the code is ugly, but ...
I'm all for performance improvement, too. If this scheme makes for faster page generation, I'll bite the bullet and learn to work with it. -- Chris Johnson