Rewrite of menu-system
I’ve started to rewrite my menu-system here at gimpster.com. The current system only works when the tree-structure is two levels deep. You can see this on my sitemap.
The new system will be able to handle an arbitrary number of levels (remember, though, that a PHP script can only use 8 MB of RAM :-).
In the new system, all pages have a parent, and perhaps also some children. This is what connects the different pages too one another, it defines a tree of so-called double-linked lists. The lists are double-linked because each node defines both the next and the previous node in the tree. This makes it very easy to find out who the parent is to a particular node. And to find other nodes at the same level as the current node, you just look up the parent. Now that you know the parent, you can easily find the children of the parent.
Thanks to the very flexible way PHP handles arrays, I can store all the information in a huge multidimensional array. That makes it very easy to access the information.
Leave a comment