Welcome to WebmasterWorld Guest from 126.96.36.199
Is there a way to get back to the root folder without having to use the full [domain.name.com...] or multiple ../ ?
I want to be able to do something like this so that when I move files in to a new directory it can still find the image or file.
<img href=<? echo $webroot ?>'myimage.jpg'>
This must be a simple answer but I'm stuck.
It seems that part of my confusion is that there isn't one solution for specifying the root path for both HTML paths and PHP paths. At least I can't make one work.
A preceding slash '/' does get you to the root for image paths for HTML.
I must have forgotten that gem.
This however does not seem to work for PHP paths for use with INCLUDE statements.
$_SERVER['DOCUMENT_ROOT'] does work for includes.
However, in my particular instance it does so only on my local server. I am running my site on the Mosso Hosting cloud and $_SERVER['DOCUMENT_ROOT'] does not produce the correct server path, so I have to specify it manually.
$_SERVER['DOCUMENT_ROOT'] does not work for me if echo'd as part of the image tag HREF path.
>> for me if echo'd as part of the image tag HREF path.
and it shouldn't, this is a filesystem path, from the root of the server, not just your website
>> A preceding slash '/' does get you to the root for image paths for HTML.
again, as designed, a slash in an html tag implies 'start at the root of the site'
so everything is working exactly as it should