I'm developing a Zend web application with classic file hierarchy structure, ie:
application/
docs/
library/
public/
tests/
Since the app is used in different machine with different server configurations, In the view scripts I would like to have link paths that work independently from where the document root has been set in the web server configuration.
Examples follow:
Host FOO is configured to point the document root to $APP/public/, and so the browser url would be "http://myapp/"
Host BAR is not configured like FOO and the browser url is "http://localhost/my/deep/path/to/$APP/public"
In the view script I would like to write the following:
<img src="<?= $urlbase ?>images/logo.gif" />
to display an images which is in $APP/public/images/logo.gif, in such a way that it works both in FOO and in BAR hosts.
What do I use in place of $urlbase?
PS: I tried to use:
<?= $this->url() ?>
but it doesn't take into account the controllers, actions, and get parameters contained in the url, that is at "http://myapp/index/login/" it returns "/index/login/", while I need it to return just "/".