PJ wrote: > Not quite, but interesting option. This would be fine on my local > intranet, if needed; but I don't think this would be allowed on a > virtual hosted site. > > Actually, my problem is to use a header.php (for example) in pages in > the webroot directory or any directory within (or under) webroot: > > / <---- webroot > /site1 > /files > /images > /lib > /more files > /admin > /other_files > /still_others > /site2 > /site3 > files > files > files... > > I have the header.php file in /lib . > If I put include dirname(_FILE_)."/lib/header.php"; in a file under > /site1, the header is displayed. > If I put the same include statement in a file under /site1/files, the > header is not displayed; if I change the include to > ..."/../lib/header.php"; it then works. > I want to be able to point to the include to the same file in the same > directory without having to change the include directive. > The problem is with how you are organizing your app. Includes are relative to the first file that's loaded, so if the first file that is loaded is in /site1/files/ then you have to know where /lib/header.php is from there. Most people don't load individual files (at least not from different dirs) as you seem to be doing. My advice is to always load the same file first from the root dir and then include your other files. Then those files will include header.php relative to the root dir. *** Example: (/site1/index.php) <?php //based upon some criteria include('files/yourfile.php'); ?> (/site1/files/yourfile.php) <?php include('lib/header.php'); ?> *** Better Example: (/site1/index.php) <?php include('lib/header.php'); //based upon some criteria include('files/yourfile.php'); ?> (/site1/files/yourfile.php) <?php //content that is original to this file ?> Above when I say "based upon some criteria", it would be something like this (example only): switch ($_GET['file']) { case 'yourfile': include('files/yourfile.php'); break; case 'somefile': include('more_files/somefile.php'); break; } -- Thanks! -Shawn http://www.spidean.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php