Hiya Marek K,
Thanks for the link, however on that page the links regarding a "Modified
Preorder Tree Traversal Algorithm" come up as 404.
Then see: http://www.sitepoint.com/article/hierarchical-data-database/2
I would prefer not to use
recursion until the third stage (display of menu). In fact I know, I will not use recursion for the first or second, simply because for each addition/change a recursion seems and is an overkill. The idea here is to have very elegant and simple code that can also be used in other classes/projects. I'm pretty much going to stick to what I have already where the only recursion that occurs is in the third stage (display of menu).
One thing I forgot to add to in my original email is that the $element property also has an order id(int) for displaying the menus in particular order.
My first and the second stage allow me to change/add elements directly without searching for them. Whereas the display does a recursion that displays in order. All of this done within php, so first and the second stage in reality is like an indexed stack. The third stage might get a little tricky due to the order property... if you have any ideas/tricks, please let me know.
I think flat table model is suited for you just right. Updating it is a little ugly but it's not that big deal.
You can also think about caching the result.
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php