I created a route to view users profiles:
$router = Zend_Controller_Front::getInstance()->getRouter();
$route = new Zend_Controller_Router_Route(
'profile/:username',
array(
'username' => 'username',
'module' => 'core',
'controller' => 'profile',
'action' => 'view'
)
);
$router->addRoute('profile',$route);
When I go there, all of the urls within the page all now say http://127.0.0.1/project/public/profile.
How do I fix this?
If using the Url
view helper or Zend_Navigation
, you need to specify the route to use if you don't want it to use the current one. For example...
Use the "default" route
<?php echo $this->url(array(
'action' => 'index',
'controller' => 'index'
), 'default', true) ?>
resources.navigation.pages.home.label = "Home"
resources.navigation.pages.home.action = "index"
resources.navigation.pages.home.controller = "index"
resources.navigation.pages.home.module = "default"
; Don't forget to set the route
resources.navigation.pages.home.route = "default"
The easiest way to configure routes is via the Router resource. Try this in your configuration instead of the code you have
resources.router.routes.profile.route = "profile/:username"
resources.router.routes.profile.defaults.module = "core"
resources.router.routes.profile.defaults.controller = "profile"
resources.router.routes.profile.defaults.action = "view"