开发者

CakePHP custom route pagination

开发者 https://www.devze.com 2023-02-11 23:37 出处:网络
I would like to format my URL like so: 开发者_开发技巧/news/index/page:2 to /news/2 I would like to achieve this result by using as less code as possible (perhaps only from routes.php?), without m

I would like to format my URL like so:

开发者_开发技巧/news/index/page:2

to

/news/2

I would like to achieve this result by using as less code as possible (perhaps only from routes.php?), without modifying how the PaginatorHelper behaves.

Thank you for your help!


This should work

// Add this to /app/config/routes.php
Router::connect('/news/:page', array('controller' => 'news', 'action' => 'index'));
0

精彩评论

暂无评论...
验证码 换一张
取 消