Hello,

When you use href=index or href=index/terms, it's a relative path. So your 
browser will add this to the "current path".

Example: If you are on http://localhost/index/action, it considers 
http://localhost/index/ your current path and because of this adds 
"index/terms" to the url resulting in http://localhost/index/index/terms


What you should be doing is using absolute paths. To get this working on ZF 
there are two helpers you may use. Considering that you have your hrefs on 
views use:

1) Zend_View_Helper_Baseurl

 href="<?php echo $this->baseUrl('index/terms'); ?>"

2) Zend_View_Helper_Url ( i would recommend this one )

href="<?php echo $this->url(array(
'controller' => 'index',
'action' => 'terms'
)); ?>"

Now you will always have: href="/index/terms".

Hope this answer helps you.

Regards,

Fernando Morgenstern
[email protected]



Em 17/06/2011, às 10:06, blur0224 escreveu:

> Hi all,
> 
> I've been working in PHP for quite a while and I've started working with the
> Zend Framework. I understand conceptually, but am experiencing unexpected
> behavior with links. From what I've read, this should work, and it does, but
> only for the index page. And even then, it only kind of works.
> 
> http://localhost/Controller/Action
> 
> I have three links, one pointing Home, About, and Terms setup as follows:
> 
> href=index
> href=index/about
> href=index/terms
> 
> When I click the about or terms link, it works, but only the first time. Any
> subsequent clicks add another index/ and in only displays the index page. I
> end up with /index/index/index/about, which displays the index.
> 
> Thanks in advance for any advice.
> 
> Taylor
> 
> --
> View this message in context: 
> http://zend-framework-community.634137.n4.nabble.com/Zend-Routing-tp3605353p3605353.html
> Sent from the Zend Framework mailing list archive at Nabble.com.
> 
> -- 
> List: [email protected]
> Info: http://framework.zend.com/archives
> Unsubscribe: [email protected]
> 
> 

Reply via email to