【发布时间】:2013-05-13 02:59:03
【问题描述】:
我正在自己编写基础内容的 CMS。
我用 Node 和 NodeType 逻辑实现了它的内容部分。 (每个 Node 都属于一个 NodeType)
Nodes 和 NodeTypes 表中都有 Slug 字段,我在路由器中写了这两条路由:
Router::connect('/:typeslug',array('controller' => 'nodetypes', 'action' => 'view'),array('pass'=>array('typeslug')));
Router::connect('/:typeslug/:nodeslug',array('controller' => 'nodes', 'action' => 'view'),array('pass'=>array('typeslug','nodeslug')));
它将实现这样的内容:http://domain.ext/article/my-custom-article
第一个问题:这是正确且正常的方法吗?
第二个问题:使用 wordpress 之类的复杂 slugging 的解决方案是什么? (例如,使用存档日期之类的 slug,例如:http://mydomain.ext/2013/01/01/article/....
更重要的是能够在管理部分中切换 slug 类型。
感谢指导
【问题讨论】: