如何编码breadcrumbs(php kohana框架)?

问题描述:

这是编码面包屑的好方法吗?如何编码breadcrumbs(php kohana框架)?

  1. 创建表的“类别”用mysql
  2. 后neccessary列“PARENT_ID”列上创建
  3. 如果PARENT_ID栏为空值,这意味着这个类是父母的if else这列父是一列在“parent_id”列中标记的ID
  4. 以递归方式从当前列开始查询“parent_id”列并打印类别名称。

如果您使用其他方法存储分层数据,面包屑更容易。

见我的介绍Models for Hierarchical Data with SQL and PHP替代品的例子:

  • 路径枚举
  • 嵌套集合
  • 关闭表

你想看看改性预购树的遍历模块

  • 小枝MPTT github.com/banks/sprig-mptt
  • 果冻MPTT github.com/AlexKupreev/jelly-mptt
  • V3 ORM MPTT github.com/kiall/kohana3-orm_mptt
  • V2 ORM MPTT dev.kohanaframework .org/projects/mptt