Hiya Marek K,

Thanks for the link, however on that page the links regarding a "Modified
Preorder Tree Traversal Algorithm" come up as 404. 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.

Thanks

Marek J

----- Original Message -----
From: "Marek Kilimajer" <[EMAIL PROTECTED]>
To: "Marek" <[EMAIL PROTECTED]>
Cc: <php-general@lists.php.net>
Sent: Wednesday, January 26, 2005 5:49 AM
Subject: Re: [PHP] Working with Multi by Multi levels menu


> Marek wrote:
> > Hello
> >
> > Creating a three dimensional menu system is pretty easy with arrays, but
> > when you want to create a menu system that is 10 or 15 levels deep using
> > arrays the conventional method is not so simple.
> >
> > I'm writing an application that shows a multi level (up to 30 levels)
menu
> > which is generated dynamically not in any particular order. There are
three
> > stages:
> >
> > First stage, generates the levels of the menu and assigns titles,
> > Second stage needs to come the levels and change its properties, ie
icon,
> > font, colour, etc. This is a critical part of the process as the menus
are
> > not generated in any order and this stage also changes the properties of
the
> > level not in any particular order.
> > The third stage needs to display this menu.
> >
> > My search on hotscripts and google didn't turn up anything that's
relevant.
> > I know I can write a recursive function for each of these stages, but
thats
> > not the best method.
>
> One recursive function that will take care of all stages.
>
> I'm not sure what table design you desided use, at level this deep you
> might use Flat Table or Modified Preorder Tree Traversal Algorithm:
>
http://www.evolt.org/article/Four_ways_to_work_with_hierarchical_data/17/404
7/
>
>

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to