I need to generate a menu based on the content structure of my database.
The data is structured using an 'id' & 'parent' relationship, for eg:
My Page 2
My Page 3
My Page 4
My Page 5
My Page 6
My Page 7
My Page 8
My Page 9
My Page 10
I need to create a recursive loop that will create the menu. The text in
the brackets is what I'm trying to achieve, the rest is just for
aesthetics & ease of reading.
(The children of the row id=1 are the top of the menu tree, ie they will
be the menu categories at the top of the web page to display the menu
when the mouse hovers over it.)
(Each menu item, being a menu, will have a href to it's id number.)
My Page 2 (Menu_1)
My Page 3 (Menu_1_1)
My Page 4 (Menu_1_1_1)
My Page 6 (Menu_1_1_2)
My Page 7 (Menu_1_1_2_1)
My Page 8 (Menu_1_1_2_2)
My Page 5 (Menu_1_2)
My Page 9 (Menu_2)
My Page 10 (Menu_2_1)
I just can't for the life of me get the numbering to work correctly in
I seem to get things like (1_1_2_1_2_3_1_2_3_4) which I can see the
pattern in, but it's obviously not what I'm after..
Appreciate your help.