dbjoe
dbjoe

Reputation: 65

Zend Framework Route issues

I have created a Route in ZF as shown below.

   /** $Router->addRoute("artistprofile", new Zend_Controller_Router_Route(
                                    "artist/:name",
                                    array("controller" => "artist",
                                    "action" => "profile"
                                    )));
  */

the problem that I am facing is that all my actions in my artist controller end up being redirected to the profile.phtml action page. For example I have an action in my artist controller called new which points to the new.phtml page and shows a signup form and I can access it like this 127.0.0.1/artist/new but only when the above code is not added as soon as I add the above code back into my script then 127.0.0.1/artist/new shows the profile.phtml page but does not redirect the user and it's the same for all my actions in the artist controller they show the contents of the profile.phtml file this is not meant to happen.

Upvotes: 0

Views: 113

Answers (1)

Garry
Garry

Reputation: 1485

It looks to me as if the Zend Router is working as it should be, all calls to 127.0.0.1/artist/name are being directed to default/artist/profile with the parameter name. The call to 127.0.0.1/artist/new is simply taking the parameter new as the artists name. If you want any calls to 127.0.0.1/artist/new to goto default/artist/new then you will need to add another route to do this.

$Router->addRoute("artistNew", new Zend_Controller_Router_Route( "artist/new", array("controller" => "artist", "action" => "new" )));

Kind regards

Garry

Upvotes: 1

Related Questions