0

I'm using an admin prefix and I want to pass some parameters to my controller but I'm having a hard time with the routing.

I want to pass variable "string1" using the url like: domainame.com/admin/DumbController/string1

I want the string1 to be passed to the index method in controller (actually called admin_index in the DumbController).

If I use the url: domainame.com/admin/DumbController/index/string1 Then it works. However I would like to using the routing to direct it to the proper action.

Here is my routing related to /admin as they are in routes.php:

Router::connect('/admin', array('controller' => 'users', 'action' => 'dashboard'
, 'admin' => true));

Router::connect('/admin/dumb/:chartType', array('controller' => 'dumb',
            'action' => 'index',
            'prefix'=>'admin',
            'admin'=>true),
            array(
                  'pass' => 'chartType',
                  'chartType' => '[a-z]+'
            )
    );

The controller has a public admin_index($chartType=null) method. I've played with the routing quite a bit, but nothing seems to work like I expect. Can someone point me in the right direction?

Thanks!

EDIT: Added the only other admin related route, but there are about 15 as there are a lot of other things going on.

user6972
  • 851
  • 1
  • 15
  • 32
  • Can you post the rest of your routes? Remember that the order in which you write them is important – Choma Jun 19 '13 at 07:04
  • @MatíasCroce I added one more rule that I think is relevant. – user6972 Jun 19 '13 at 19:51
  • I can't see why it is not working. The only thing I can think is a precedences problem, have you tried putting `Router::connect('/admin/dumb/:chartType' ...` in the first place?? – Choma Jun 20 '13 at 22:04

0 Answers0