Michael A. Peters wrote:
> PJ wrote:
>> I hope I'm not out of place here, but I have a problem that seems to be
>> I am using some include statements for page headers with the pages in
>> various directories on the site. The problem is this... if I put
>> relative statements in the page (header.php) like ../images/file.jpg and
>> ../file.php etc, if the page into which I include header.php is not in
>> the top level directory, the links do not work and I have to copy
>> header.php to header1.php and change the references to /images otherwise
>> images are not displayed and links to not work in href.
>> 1. top level file books.php
>> include ("lib/db1.php"); // Connect to database
>> include ("header1.php");
>> 2. subdirectory: /authors/a.php
>> include "../header.php";
>> I thought that using referencing the top level of the directory tree
>> (../) would work form anywhere within the tree?
>> Am I the victim of my own misconceptions here?
>> TIA to set me straight.
> Easy to solve.
I neglected to mention, although, it must be fairly obvious that I'm
fairly new to all this ["newbie" but not virgin :-) ]
Comments below -->
1. Where to I put it?
2. srv = ? domain = ? phpinclude = ? record, process... = ? server, but
like what? a url?
> Then just call it without path - IE
> php will first look for foo.inc in /srv/domain/phpinclude, then in
> /srv/domain/record_include, etc.
> make directories for your includes, preferably outside the web root,
> and define your include path at the top of your script.
> I personally don't like to have . as part of my include path, and
> relative include paths (id somedir/foo.inc) are IMHO an even worse
What do you suggest as a better prctice?
Phil Jourdan --- p...@ptahhotep.com
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php