开发者

PHP Zend framework - Many layer menu

开发者 https://www.devze.com 2023-02-09 17:13 出处:网络
In my application, i want to make a dynamic multi layer menu like this Toy1 ==>Sub toy1-a ==>Sub toy1-b 开发者_Go百科 Toy2

In my application, i want to make a dynamic multi layer menu like this

Toy1

==>Sub toy1-a

==>Sub toy1-b

开发者_Go百科

Toy2

==>Sub toy2-a

==>Sub toy2-b

Toy3

==Sub toy3-a

I have created 2 table in database called parent-Menu contain Toy1,Toy2,Toy3 and sub-Menu contain Sub toy1-a, Sub toy1-b and their father which it belongs. I don't know how to retrieve database or algorithm to make this. Anybody have solution ?


I can recommend you to use only one table, it will make your program very eaisy.

take 3 field *menu_id* , *menu_text* , *parent_id* for all top menu take parent id 1. now do the following work,

Retrieve all data from the table.

And use the recursive function to the place the menu.

0

精彩评论

暂无评论...
验证码 换一张
取 消