How to show categories and sub categories in view page and select menu in zend frame work
i'm having the table like
category_id category_name parent_id
1 General Grocery 0 2 Ready to eat 0 3 rice 1 4 oils 1 5 flour 1 6 seed 1 7 tes开发者_StackOverflow社区ting cate 0 8 testing 5i want to display the categories with "n" number of sub categories in subcategories. My main moto is by using the array generated by the code i want to display in view page and the select menu in the zend form. I found the code in php. but i'm unable to use that in zend. Can some one help me out with this please. Thank you.
I think you need to generate a tree.. so there are two known patterens to me
- adjacency level pattern
- Nested Level Patteren
I suggest you to use Nexted level pattern
If you follow the given below two links you will surely come to know what to do.
- http://blog.richardknop.com/2009/05/nested-set-model/
- http://baobab.sideralis.org/
By this you can generate appropriate tree. now you have to generate a tree in which you can select your items. so you should use this tree http://www.dhtmlx.com/docs/products/dhtmlxTree/index.shtml
you can keep checkboxes to select the items and store in the database
精彩评论