contact

2007-09-12

Please use the comment form bellow to contact me, include your email so I can talk back.

Share this with the world

Comments

Csanad Komlos

Hi,

I'm trying to create a mod based on your script "infinite depth categories" at
http://www.codeassembly.com/How-to-display-infinite-depth-expandable-categories-using-php-and-javascript
I've been struggling with it for days now and thought you were the one to ask. I hope you have some time for it and help me.

I would like to print every category names and want to append to them links to every subsequent pages if they have one (to make it clear I simplified my project here, later I want to modify categories to be pages with the links in them).

Thanks in advance
Csanad Komlos

E.g. I have a menu tree with parent and child members that has the structure:

one
one one
one one one
one two
two
two one
two two
three

And this is how I want it to look like:

one one one one two
one one one one one
one one one
one two
two two one two two
two one
two two
three

I have put them in an array as per your instructions. I had to create "Fake" array index 0 so that "one" starts with key 1. It is not needed when traversing the array.

$menu_array = Array
(
0 => Array
(
'name' => 'Fake',
'parent' => -1
),

1 => Array
(
'name' => 'one',
'parent' => 0
),

2 => Array
(
'name' => 'one one',
'parent' => 1
),

3 => Array
(
'name' => 'one one one',
'parent' => 2
),

4 => Array
(
'name' => 'one two',
'parent' => 1
),

5 => Array
(
'name' => 'two',
'parent' => 0
),

6 => Array
(
'name' => 'two one',
'parent' => 5
),

7 => Array
(
'name' => 'two two',
'parent' => 5
),

8 => Array
(
'name' => 'three',
'parent' => 0
)

);

Posted on 2008-03-21 14:02:43

Get yourself heard

Categories

Subscribe

All Posts

All Comments

This post comments

© Copyright CodeAssembly

All code is licensed under GPL, unless otherwise noted