0

Zend Bootstrap is not following this route:

    $route = new Zend_Controller_Router_Route_Regex (
        '(.+)-hospital-lottery',
        array('module' => 'default','controller'=>'hospital','action'=>'index'),
        array(1 => 'province')
    );

Trial URL being http://mydomain.com/something-hospital-lottery

No luck even including a fourth sprintf param...I feel this has something to do with a lack of /'s.

3
  • 1
    Because it's not being added properly? (-; Commented Mar 3, 2012 at 18:00
  • I'm adding it with: $router->addRoute('hospitals', $route); where I have: $frontController = Zend_Controller_Front::getInstance(); $router = $frontController->getRouter(); I already have several other routes in the file, it's just this one that I had to change to use regex... Commented Mar 3, 2012 at 18:45
  • 1
    Solved. Issue was that another route in the routine was overriding: (.+)-hospital-lottery /:province The latter was capturing whatever-hospital-lottery as the province param. A lesson to me and whomever else with this problem to mind and respect the order of your route declarations...! Will post accepted answer in 5 hours when I'm able. Commented Mar 3, 2012 at 19:56

2 Answers 2

1

It looks fine, I tested it and it worked fine.

How are you attempting to add it to the router?

Try adding this line after you create the route:

Zend_Controller_Front::getInstance()->getRouter()->addRoute('h-lottery', $route);
Sign up to request clarification or add additional context in comments.

1 Comment

See my comment above...I'm adding it just like my other routes that work fine.
0
$route = new Zend_Controller_Router_Route_Regex (
    '(.*)-hospital-lottery',
    array('module' => 'default','controller'=>'hospital','action'=>'index'),
    array(1 => 'province')
);

2 Comments

Where it goes actually? when you visit your trial URL?
It skips down to my catch-all route at the bottom of the route listing, and tries to send it to a controller called something-hospital-lottery. So just basically just doesn't detect my route above as a matching condition

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.