Reply to url vs dirname(__FILE__)

Your name:

Reply:


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

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация