0

When I added this route

$classes_router = new Zend_Controller_Router_Route(
    '/:filter1/:filter2/*',
    array(
        'module'     => 'course',
        'controller' => $filter_controller,
        'action'     => 'index',
        'filter1'    => '',
        'filter2'    => ''
    )
);

Te default route :module/:controller/:action doesn't work anymore. Please tell me what is the problem?

drew010
  • 68,777
  • 11
  • 134
  • 162

1 Answers1

2

The problem is that a request to somemodule/somecontroller/someaction will be matched by the route you've added (which will be checked before the default one). You need to provide some restriction in the route to determine what it matches, perhaps by limiting the possible matches for the :filter1 variable:

$classes_router = new Zend_Controller_Router_Route(
    '/:filter1/:filter2/*',
    array(
        'module'     => 'course',
        'controller' => $filter_controller,
        'action'     => 'index',
        'filter1'    => '',
        'filter2'    => ''
    ), array(
        'filter1' => '(value1|foo|somethingelse)'
    )
);

or adding a static prefix:

$classes_router = new Zend_Controller_Router_Route(
    '/filter/:filter1/:filter2/*',
    array(
        'module'     => 'course',
        'controller' => $filter_controller,
        'action'     => 'index',
        'filter1'    => '',
        'filter2'    => ''
    )
);
Tim Fountain
  • 33,093
  • 5
  • 41
  • 69