Hi, You could use $_SERVER['DOCUMENT_ROOT']
"Robert Cummings" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > On Thu, 2004-06-03 at 23:15, Stephen Craton wrote: > > I've wondered for quite some time, and search just as long it seems like, > > for a way to get the current URL directory. For example, let's say you were > > at www.example.com/files. The script is executing in this directory, and > > it's calling an include script from the base (www.example.com or maybe even > > www.example.com/includes). In this included file are some links and maybe > > some images. These images and links are set up to be called from the base > > directory, so basically all the links inside the file say something like > > "images/bob.gif" or something of that nature. > > > > How could you dynamicaly change this in relation to where the included > > script is? If I were to include it in that files in /files, it would look > > for the images in /files/images/bob.gif which would not be there. One > > solution I have thought of is just putting the / at the beginning (/images/) > > but that wouldn't be the safest solution if the script were running in a > > subfolder to begind with (like the entire site is in www.example.com/site1). > > > > I hope you understand what I'm trying to say. Any ideas? > > In a configuration file shared by the project's scripts have a constant > or global variable like follows: > > $GLOBALS['imageBase'] = '/site1/'; > > Now wherever in your site you use an image you can use this value to > prepend the image path. > > Cheers, > Blobbie. > -- > .------------------------------------------------------------. > | InterJinn Application Framework - http://www.interjinn.com | > :------------------------------------------------------------: > | An application and templating framework for PHP. Boasting | > | a powerful, scalable system for accessing system services | > | such as forms, properties, sessions, and caches. InterJinn | > | also provides an extremely flexible architecture for | > | creating re-usable components quickly and easily. | > `------------------------------------------------------------' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php