> How can I create a global header and footer include to my site pages where > I > don't rely on absolute paths to include and image files? > > I'm having trouble including my header and footer .inc's within a > multi-level directory structure -- the relative paths to images (and to > includes within includes) are not currently accessed within the current > directory structure. > > I'm assuming I'll need to prepend all image and include files with a path > variable that I set within each page, or something along those lines?
When you call file.php, all includes and any nested includes are relative to the directory that file.php is in. That means if you include a file called subdir/file2.php and it attempts to include something, it's going to start looking for it in the same directory as file.php. No way around that. What's your fear of absolute paths? I always set two variables, the absolute path of my files and the web address. $_CONF['path'] = '/home/me/www/program'; $_CONF['html'] = 'http://www.domain.com/program'; for example. Then do all of your paths based off of those. If you don't want to do that, then you can probably play around with $_SERVER['PHP_SELF'] and basename() and the like to do what you want. ---John W. Holmes... PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php