Route CakePHP Plugin from /users/users/index to /users/index
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.
精彩评论