I have a plugin named Manager. I want to map route on /login to the index action of Dashboard Controller on plugin. Something like this:
我有一个叫“经理”的插件。我想要在插件上将路径映射到仪表板控制器的索引操作。是这样的:
Router::connect('/login', array('controller' => 'dashboard', 'action' => 'index', 'plugin => 'manager'));
How can I achieve this on Cakephp 2.2?
如何在Cakephp 2.2中实现这一点?
thanks
谢谢
2 个解决方案
#1
4
Once a plugin has been installed in /app/Plugin
, you can access it at the URL /plugin_name/controller_name/action
. In your Manager plugin example, you'd access DashboardController at /manager/dashboard
.
一旦插件安装在/app/插件中,你就可以在URL /plugin_name/controller_name/action中访问它。在您的Manager plugin示例中,您将访问/ Manager /仪表板上的DashboardController。
Have you tries using Plugin Syntax, like:
你试过使用插件语法吗?
Router::connect('/login',
array('controller' => 'Manager.dashboard', 'action' => 'index')
);
Using the 'plugin'
key in the $options
array should also do the job:
在$options数组中使用“插件”键也可以完成任务:
Router::connect('/login',
array('plugin' => 'manager','controller' => 'dashboard', 'action' => 'index')
);
#2
0
If use plugin like 'users plugin' try in plugin's routes file (routes.php)
如果在插件的路由文件中使用“用户插件”这样的插件。
#1
4
Once a plugin has been installed in /app/Plugin
, you can access it at the URL /plugin_name/controller_name/action
. In your Manager plugin example, you'd access DashboardController at /manager/dashboard
.
一旦插件安装在/app/插件中,你就可以在URL /plugin_name/controller_name/action中访问它。在您的Manager plugin示例中,您将访问/ Manager /仪表板上的DashboardController。
Have you tries using Plugin Syntax, like:
你试过使用插件语法吗?
Router::connect('/login',
array('controller' => 'Manager.dashboard', 'action' => 'index')
);
Using the 'plugin'
key in the $options
array should also do the job:
在$options数组中使用“插件”键也可以完成任务:
Router::connect('/login',
array('plugin' => 'manager','controller' => 'dashboard', 'action' => 'index')
);
#2
0
If use plugin like 'users plugin' try in plugin's routes file (routes.php)
如果在插件的路由文件中使用“用户插件”这样的插件。