Welcome to WebmasterWorld Guest from

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

ZF Routing Insanity

i can route, but what about all my actions?

3:21 am on Sep 21, 2010 (gmt 0)

Junior Member

10+ Year Member

joined:Mar 25, 2004
posts: 161
votes: 0

i have a controller with several actions:


i set up routing so that user/randomusername would redirect to user/view

but now if i type any of the other 3 actions into the url, it goes to user/view!

$FrontController = Zend_Controller_Front::getInstance();
$Router = $FrontController->getRouter();

$Router->addRoute("viewuser", new Zend_Controller_Router_Route(
"user/:username", array (
"username" => "Spongebob",
"controller" => "user",
"action"=> "view"

surely i dont have to add routes for the other actions? they worked fine before i added this....
10:51 am on Oct 5, 2010 (gmt 0)


WebmasterWorld Administrator coopster is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:July 31, 2003
votes: 3

Anybody using Zend Framework that can lend a hand here?
3:25 pm on Oct 5, 2010 (gmt 0)

Junior Member

10+ Year Member

joined:Mar 25, 2004
posts: 161
votes: 0

Issue: Routing rule will not allow localhost/artist/new to load
In chapter 3 I asked you to add in the routing rule artist/:artistName. When the system encounters the pattern artist/new, the system will think “new” is the artistName.
Update the routing rule to ‘artist/profile/:artistName’ the complete Zend_Route should be as shown below:
new Zend_Controller_Router_Route(
array("artistname" => "The Smiths",
"controller" => "artist",
"action" => "profile"))

So unlike site/user (which won't work)
You now use siteprofile/user

Which I don't like so much, but hey it works!
Again, if you REALLY want the first option you must explicitly declare all the other actions :-s

All the best amigo!

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members