Reputation: 1919
i put this code in bootstrap file
//product category url managment
$defaults = array('controller'=>'productcat' , 'action'=>'catinfo' );
$productRoute = new Zend_Controller_Router_Route('productcat/:id/:title', $defaults);
$router = $frontController->getRouter();
$router->addRoute("productcat", $productRoute);
and i put this code in one of phtml files (in layout)
<a href="<?php echo $this->url(array( "controller"=>"aboutus" , "action"=>"index")); ?>">about us</a>
but when i`m in a url like this :
http://quickstart.local/donyaye_fan_zend/public/
every things is ok.
if i go to url like this: http://quickstart.local/donyaye_fan_zend/public/productcat/1/sample
link for aboutus dont work and it show current page url in href!!!
what is the reason?!
Upvotes: 2
Views: 1683
Reputation: 1097
You should specify default route to use. Try this:
<a href="<?php echo $this->url(array( "controller"=>"aboutus" , "action"=>"index"), 'default'); ?>">about us</a>
If it will not help, then try to reset the route with:
<a href="<?php echo $this->url(array( "controller"=>"aboutus" , "action"=>"index"), 'default', true); ?>">about us</a>
Upvotes: 4
Reputation: 1267
In case of different routes is better to specify the route "default" for each link that use no custom routes.
so:
<a href="<?php echo $this->url(array( "controller"=>"aboutus" , "action"=>"index", "route"=>"default")); ?>">about us</a>
should work
Upvotes: 2