简体   繁体   English

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

[英]how to code breadcrumbs (php kohana framework)?

is this good way to code breadcrumbs? 这是编码面包屑的好方法吗?

  1. create table "categories" using mysql 使用mysql创建表“类别”
  2. create after neccessary columns "parent_id" column 在必要的列“parent_id”列之后创建
  3. if parent_id column have null value it means that this category is parent and if else this columns parent is a column with id which marked in "parent_id" column 如果parent_id列具有空值,则表示此类别是父类,如果是,则此列父类是具有标记在“parent_id”列中的id的列
  4. recursively query to "parent_id" column starting at current column and print category name. 从当前列开始递归查询“parent_id”列并打印类别名称。

Breadcrumbs are easier if you use other methods of storing hierarchical data. 如果使用其他存储分层数据的方法,面包屑会更容易。

See my presentation Models for Hierarchical Data with SQL and PHP for examples of alternatives: 有关备选方案的示例,请参阅我的演示文稿使用SQL和PHP的分层数据模型

  • Path Enumeration 路径枚举
  • Nested Sets 嵌套集
  • Closure Table 关闭表

You want to check out Modified Preorder Tree Traversal modules 您想要查看Modified Preorder Tree Traversal模块

  • Sprig MPTT github.com/banks/sprig-mptt Sprig MPTT github.com/banks/sprig-mptt
  • Jelly MPTT github.com/AlexKupreev/jelly-mptt Jelly MPTT github.com/AlexKupreev/jelly-mptt
  • v3 ORM MPTT github.com/kiall/kohana3-orm_mptt v3 ORM MPTT github.com/kiall/kohana3-orm_mptt
  • v2 ORM MPTT dev.kohanaframework.org/projects/mptt v2 ORM MPTT dev.kohanaframework.org/projects/mptt

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM