How to connect to a plugin route on routes.php file CAKEPHP

2.2k views Asked by At

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?

thanks

2

There are 2 answers

0
sdagli On

If use plugin like 'users plugin' try in plugin's routes file (routes.php)

0
Borislav Sabev On

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.

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:

Router::connect('/login', 
    array('plugin' => 'manager','controller' => 'dashboard', 'action' => 'index')
);