Re: [PHP] Recursion: Ugh!

2005-05-27 Thread Chris
Chris W. Parker wrote: Marek Kilimajer mailto:[EMAIL PROTECTED] on Thursday, May 26, 2005 11:35 AM said: untested: function display($array, $prefix = '') { echo $prefix ':' . $array['name'] . \n; if(is_array($array['children']) $array['children']) {

Re: [PHP] Recursion: Ugh!

2005-05-27 Thread Chris
Chris W. Parker wrote: Hi everyone, I've been working on a problem for a few days now and I'm not making any headway so I think it's time I come to the list for some help (though this really disappoints me since it appears I'm not capable of solving this problem on my own!). Anyway, I'm

Re: [PHP] Recursion: Ugh!

2005-05-27 Thread Chris
Chris W. Parker wrote: Hi everyone, I've been working on a problem for a few days now and I'm not making any headway so I think it's time I come to the list for some help (though this really disappoints me since it appears I'm not capable of solving this problem on my own!). Anyway, I'm using

Re: [PHP] Recursion: Ugh!

2005-05-27 Thread Steve Brown
Food:Fruit:Red Food:Fruit:Green Food:Fruit:Yellow Food:Vegetables:Long Food:Vegetables:Round Food:Vegetables:Round:Spikey Food:Vegetables:Round:Smooth How is your structure being built? Is it hard-coded or dynamic (e.g. pulled from a DB)? We employ a similar tree structure for manging

RE: [PHP] Recursion: Ugh!

2005-05-27 Thread Chris W. Parker
Steve Brown mailto:[EMAIL PROTECTED] on Thursday, May 26, 2005 11:47 AM said: How is your structure being built? Is it hard-coded or dynamic (e.g. pulled from a DB)? From a database. We employ a similar tree structure for manging items in our store front. Believe me when I say, its a

Re: [PHP] Recursion: Ugh!

2005-05-27 Thread Steve Brown
On 5/27/05, Chris W. Parker [EMAIL PROTECTED] wrote: Let's say you're entering a new product, you'd want to see a list of all the available categories, not just the last node of a branch. Not neccesarily; it depends on how big your tree structure is. If you only have 10 categories where an

Re: [PHP] Recursion: Ugh!

2005-05-27 Thread Steve Brown
** email gagging, sorry if this is a DP ** On 5/27/05, Chris W. Parker [EMAIL PROTECTED] wrote: Let's say you're entering a new product, you'd want to see a list of all the available categories, not just the last node of a branch. Not neccesarily; it depends on how big your tree structure is.

RE: [PHP] Recursion: Ugh!

2005-05-27 Thread Chris W. Parker
Steve Brown mailto:[EMAIL PROTECTED] on Friday, May 27, 2005 2:17 PM said: So in your case, if you wanted to create a new item in the category Round, you would first have to navigate to Food Vegetables Round, then create the new item. This may seem more complicated, but think about how

Re: [PHP] Recursion: Ugh!

2005-05-26 Thread Marek Kilimajer
Chris W. Parker wrote: Hi everyone, I've been working on a problem for a few days now and I'm not making any headway so I think it's time I come to the list for some help (though this really disappoints me since it appears I'm not capable of solving this problem on my own!). Anyway, I'm using

RE: [PHP] Recursion: Ugh!

2005-05-26 Thread Chris W. Parker
Marek Kilimajer mailto:[EMAIL PROTECTED] on Thursday, May 26, 2005 11:35 AM said: untested: function display($array, $prefix = '') { echo $prefix ':' . $array['name'] . \n; if(is_array($array['children']) $array['children']) { foreach($array['children'] as

Re: [PHP] Recursion: Ugh!

2005-05-26 Thread Rory Browne
This would have been easier if you'd posted the php code to create the array, as opposed to the output of print_r. I did this: ?php $arr = array( array( 'name' = 'food', 'children' = array( array( 'name' = 'meat',