Posted by "Chris" on 11/30/05 05:25
I trying to create an absolute path to include scripts and images in another
directory. For includes, I have found $path = dirname(__FILE__)
.."/mydir/myscript.php";
However, I am unable to reference an image using this path, like
echo "<img src=" . dirname(__FILE__) . "/mydir/myimage.gif>";
To reference an image I have to create another path variable which assembles
a url like:
echo "<img src=http://" . $_SERVER['HTTP_HOST'] .
dirname($_SERVER['SCRIPT_NAME']) . "/mydir/myimage.gif>";
Is it possible to create just one absolute path variable for both the
include and img src= or do I need to create two paths?
Thanks
cw
Navigation:
[Reply to this message]
|