开发者

Zend framework, URL view helper and the layout

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 rout开发者_运维技巧e. 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!


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜