jonathan11
New Member
Hi,
I'm using php include to build the header of all my site pages.
This was fine once all pages were in the main directory and I could display an image in the header like this....
<a href="/"> <img src="img/logo.png" /> </a>
Now I want to introduce pages in another directory. This is where the above code falls down since img/ directory is not at the same level.
So I tried doing this...
$img = $_SERVER['DOCUMENT_ROOT'] . '/img/logo.png';
print "<a href=\"/\"> <img src=\"" . $img . "\" /> </a>";
However I can't get this to display the image, when I look at the source code of the page I see...
<a href="/"> <img src="/home/broadban/public_html/mobileplans.ie/img/logo.png" /> </a>
Any idea why its not displaying the image? this is really bugging me.
Thanks,
Jonathan
I'm using php include to build the header of all my site pages.
This was fine once all pages were in the main directory and I could display an image in the header like this....
<a href="/"> <img src="img/logo.png" /> </a>
Now I want to introduce pages in another directory. This is where the above code falls down since img/ directory is not at the same level.
So I tried doing this...
$img = $_SERVER['DOCUMENT_ROOT'] . '/img/logo.png';
print "<a href=\"/\"> <img src=\"" . $img . "\" /> </a>";
However I can't get this to display the image, when I look at the source code of the page I see...
<a href="/"> <img src="/home/broadban/public_html/mobileplans.ie/img/logo.png" /> </a>
Any idea why its not displaying the image? this is really bugging me.
Thanks,
Jonathan