Andy
Andy

Reputation: 735

zend framework routing 1.11

i cant seem to get my simple route to work.

I want this URL:

example.com/restaurant/1/a-restaurant-name.html

to be converted top

example.com/restaurant?id=1*name=a-restaurant-name

i have the following Route, but it doesnt work, all i get is a redirect to my 404 page.

$rest_friendly = new Zend_Controller_Router_Route(
    "/restaurant/:id/:name",
        array(
            "module"        => "default",
            "controller"    => "restaurant",
            "action"        => "index"
        )
    );

i have this loaded in a preDispatched Frontcontroller plugin called Route.

the plugin is 100% getting loaded as a die("Loaded") will always fire.

Additionally i have no idea how to debug this.

Upvotes: 0

Views: 700

Answers (1)

Tim Fountain
Tim Fountain

Reputation: 33148

preDispatch() is called after routing has finished which is why what you have doesn't work. Like prodigitalson suggested in the comment, you should add the route in your bootstrap instead.

Upvotes: 1

Related Questions