开发者

Route CakePHP Plugin from /users/users/index to /users/index

开发者 https://www.devze.com 2023-02-23 05:00 出处:网络
I have just dropped the CakeDC Users plugin into my CakePHP App, the only issue is that all the pages that use the plugin are accessed through /users/users/action, which looks rubbish with \'users\' i

I have just dropped the CakeDC Users plugin into my CakePHP App, the only issue is that all the pages that use the plugin are accessed through /users/users/action, which looks rubbish with 'users' in there twice. It is my understanding that prior to CakePHP 1.3, there was 'magic' routing that put the users plugin in /users, is there a way to replicate this behaviour in CakePHP 1.3 ? I need it to work fine with admin prefixes too.

Update After talking to the helpful guys in #cakephp, it's been suggested that I just setup 2 routes for the users plugin for the admin and 'normal' actions. There is noy way to re-create the 'magic' routing from 1.2.

Router::connect('/users/:action', array('plugin' => 'users', 'controller' => 'users'));
Router:开发者_如何学Python:connect('/admin/users/:action', array('plugin' => 'users', 'controller' => 'users', 'prefix' => 'admin'));


you can just go to /users by default and you will get there.

cake will know automatically if the plugin is called users, and it has a controller called users with an action called index.

0

精彩评论

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