I have the following route defined:
$route = new Zend_Controller_Router_Route(
'users/:id',
array(
'controller' => 'users',
'action' => 'profile',
'id' => ''
)
);
When I am on the page via the shortened URL (localhost/users/someuser), the URLs defined in the layout file all link to “localhost/users”. Here is the code in the layout:
<li><a href="<?php echo $this->url(array('controller' => 'index'), null, true); ?>">Home</a></li>
<li><a href="<?php echo $this->url(array('controller' => 'search'), null, true); ?>">Search</a></li>
<!-- etc. -->
How can I fix the code so that the links in the layout file point to the correct URLs?
You should define the route you want to use when calling the helper, as otherwise it will use the current route, which is your
users/:idone. I’m assuming in the case of the two examples you give, it would be'default'. Try replacingnullin the the helper call with it.