分层菜单树,包括任何级别的所有子项

问题描述

|| 我正在考虑最好的方法是为商店式系统存储给定的菜单树。其中包括一个菜单树,其中包含多个子级别以及分配给这些级别的项目。 特殊要求:  -每个级别都必须包含子级别和子n级别的所有项目  -每个项目(可能!)被分配到多个级别 简短示例:
[Category A]
  [Category A-A]
    - Product: Apple
    [Category A-A-A]
      - Product: Pear
[Category B]
  - Product: Salad
  - Product: Apple
以下输出: -显示根:应显示树和所有产品(1x苹果!,梨和沙拉) -显示类别A-A:应显示树+苹果和梨 -显示类别A-A-A:应显示树+仅梨 有任何建议或提示可以在PHP和MySQL的帮助下实现吗?     

解决方法

        看一下: http://mikehillyer.com/articles/managing-hierarchical-data-in-mysql/ 和 http://en.wikipedia.org/wiki/Nested_set_model (初读)     ,        您应该为此使用javascript树库,该树库可以从PHP代码生成。 请参阅以下链接,您可以选择任何人。 http://www.queness.com/post/1138/10-javascriptcss-treeview-and-sitemap-plugins-and-tutorials     

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...