ZF-7381: referingUrl for Zend_View_Helper


I'm using this to easily get the refering url

class My_View_Helper_ReferingUrl extends Zend_View_Helper_HtmlElement { /** * Returns the refering url or using url Helper as backup * * @param array $backup * @return string */ public function referingUrl(array $backup) { $url = Zend_Controller_Front::getInstance()->getRequest()->getHeader("REFERER"); if(!$url) { $url = $this->view->url($backup); }

    return $url;



Existing view helpers contained in the Zend Framework are all shortcuts or references to other Zend Framework components. From this perspective a shortcut to a request header (referer) is not suitable for implementation in the framework.

Resolving this issue as 'Needs proposal'. If you think this view helper could be of use for the framework, feel free to start a discussion on it on the contributer mailing list.