Thanks again John for the informative reply. Now I follow what you're doing.
Get some sleep ;--) --Noah ----- Original Message ----- From: "John W. Holmes" <[EMAIL PROTECTED]> To: "'Noah'" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Saturday, February 22, 2003 1:56 PM Subject: RE: [PHP] Sitewide Header & Footer Includes || Trouble with Relative Paths.......... > > Hey John. > > > > Do you ever sleep? You've got a zillion posts in this news > > group.......... > > Sleep is for the weak... > > > To answer your question, it's not that I'm afraid of absolute paths, > it's > > that I don't properly understand how to implement them. > > > > I understand why the path references are not working when I move > beyond > > the > > root level directory, but getting the file reference to work beyond > the > > root > > is the tricky part for me. > > > > For example, with $_CONF['path'] = '/home/me/www/program'; set in my > > global_vars.inc how will I reference my image files? As > > $path.image_file_name? > > > > Could you provide an image file reference code snippet? > > For images, you'll need a "web path", that's where $_CONF['html'] comes > in. > > Okay, say my program is installed in /home/user/john/www/subdir/ and I > call it from the web with http://www.mydomain.com/subdir. I define two > variables: > > $_CONF['path'] = '/home/user/john/www/subdir'; file://filesystem path > $_CONF['html'] = 'http://www.mydomain.com/subdir'; file://web path > > Now, to include a file, you'd use: > > include($_CONF['path'].'/include.php'); > > to include from another subdirectory: > > include($_CONF['path'].'/directory/functions.php'); > > Now, say I'm within functions.php and want to include a file that's > somewhere else. You're providing an absolute path, so it's not a big > deal. > > Include($_CONF['path'].'/anotherdir/classes.php'); > > Now, to include an image tag in your HTML, you'd use: > > <img src="{$_CONF['html']}/images/image.jpg"> > > Or, if all of your images are always in the same directory, you can > define a > > $_CONF['images'] = 'http://www.mydomain.com/images'; > > and use > > <img src="{$_CONF['images']}/image.jpg"> > > Hope that helps. The other suggestions are good, too, but I wouldn't use > those method. That's just me, though. > > ---John Holmes... > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php