views:

57

answers:

1

Hello,

I've been using Zend framework some time now, but I'm facing a problem I can't solve myself. I'm using Zend_Layout, Zend_View and the URL view helper to create hyperlinks. To create some SEO-friendly URL's, I use the following code in my layout.phtml:

<?php echo $this->url( array( 'module' => 'default', 'controller' => 'contact' ), 'contact', true ); ?>

This works fine. The link is contact.html (this is dealt with in my bootstrap). But when I try to access a different page which is not routed (backend pages don't need to have SEO-URL's) after I visit the contact page, Zend automatically uses the current route. To make things clearer, the code I use to create a link to a backend page in my layout.phtml:

<?php echo $this->url( array( 'module' => 'admin', 'controller' => 'manage' ), null, true ); ?>

The second parameter, null, is used to tell the helper that no route is used for this link. But it seems that Zend automatically uses the current route (the contact route). How to solve this problem?

Thanks in advance!

+3  A: 

Use 'default' as the route parameter. null tells the URL view helper to use the current route not, as you thought, no route

gnarf
Thanks, that did the trick. I have spent hours on finding this answer, and got in in less then a minute on StackOveflow. Wondering if this is actually documented by Zend.
Martijn Dwars
Well the parameter is documented in the code: `@param mixed $name The name of a Route to use. If null it will use the current Route` so I would assume it shows up in the Zend Documentation...
gnarf