使用CakePHP 1.3我试图获得具有语言,slug,分页,顺序的路由器。
目前我有这些:
Router::connect('/', array('controller' => 'pages', 'action' => 'index'));
Router::connect("/:controller/:slug", array('action' => 'view'), array('pass' => array('slug')));
Router::connect("/:lang", array('controller' => 'pages', 'action' => 'index'), array('lang' => 'fr|en|de'));
Router::connect("/:lang/:controller/:slug", array('action' => 'view'), array('lang' => 'fr|en|de', 'pass' => array('slug')));
那些正在使用语言和slug set或slug和pagination,但是这三个都失败了:
OK - /pages/view/page-slug/page:2
OK - /fr/pages/page-slug
FAIL - /pages/view/page-slug/page:2/lang:fr
我试过了
<?php $this->Paginator->options(array('url' => $this->passedArgs)); ?>
在分页符之前但仍然是相同的结果
答案 0 :(得分:1)
试试这段代码
Router::connectNamed(array('language','pagination','order','slug'));
Router::connect('/lang/pagination/:slug:order', array(
'plugin' => false,
'controller' => 'pages',
'action' => 'index',
),array(
"pass"=>array("lang","pagination","slug","order")
),array(
'pagination' => '[0-9]+',
'order' => '[0-9]+',
)
);