zend framework how to avoid baseurl getting prepend to the link
Links redirecting to other website not working....
Am trying to display member's website as a link, which is retrieved from database, as link, when clicked should redirect or go to that website. But members website url is getting appended to the end of the site base url as shown bel开发者_JAVA百科ow .
[a] href="www.mysite.com/member/details/<member website url>">Click for Web Site[/a]
I want this to be as
[a] href="<member website url>">Click for Web Site[/a]
the code , in phtml:
[a] herf="<?php echo $this->data['website']">Click for Web Site[/a]
how to avoid baseurl getting prepend to the link.
www.mysite.com/member/details/ is not a valid URL - this needs to be http://www.mysite.com/member/details/ for the link to work as you are expecting. Since the link doesn't start with a URL scheme, the browser (not ZF) is assuming the link is relative to the current page which is why you are having trouble.
I would suggest checking the URLs entered by your members when they are saved, and prepending http:// to the front of them if necessary. Alternatively you could write a quick view helper to add that in when showing the links on the frontend.
精彩评论