Tell please what script uses zend framework for definition current URL? More exactly I interest what use ZEND for definition domain name: this $_SERVER['HTTP_HOST'] or this
$_SERVER['SERVER_NAME'] ? (or may be something other)?
P.S. ( I search in documentation but not found, (I do not know this framework), also I search in google, but also not found answer on my question? )
Try use:
$this->getRequest()->getRequestUri()to get current of requested URI.In the view script use:
$this->url()to get current URL.Or using via static integrated Zend Controller front via instance:
$uri = Zend_Controller_Front::getInstance()->getRequest()->getRequestUri();You can get a value of URI implementation via singleton to get a value of request() data:
On the View use it as:
You should avoid hardcode such as example (NOT TO USE!):
instead of this example use as on a view:
If you want using getRequest in ZEND more explore The Request Object.
SKIP IT BELOW (AUTOPSY EXAMPLE HOW WORKS IT).
Full of example code how getRequestUri() how it works and why is isRequest instead using
$_SERVERis because on a platform specific is randomly get a data:first if uri null, thand if requested from IIS set is as HTTP_X_REWRITE_URL. If not, check on IIS7 rewritten uri (include encoded uri). If not on IIS than REQUEST_URI will check scheme of HTTP_HOSTNAME, or if failed use as ORIG_PATH_INFO and grab a QUERY_STRING.
If is setted, grab a data automatically via string of returned object
$thisin a class.If failed, than will be set a parsed string than set it.