"David VanHorn" <[EMAIL PROTECTED]> wrote:
> I know this works, in footer.inc, to pull up nomenu.
> <? include("/home/dvh/public_html/footer-nomenu.inc")?>
>
> However, is there a more "generic" way to specify the server root as the
path?
> I'd rather not expose my directory structure in the PHP code.

How about the environment variable $DOCUMENT_ROOT (you may need to access as
$GLOBALS[DOCUMENT_ROOT] depending on your code).  Put <?php phpinfo(); ?> in
a webpage to see all of the goodies available to you.  I personally prefer
to keep the bulk of my PHP code outside the document root, in a directory
parallel to it.  I define a constant INC_PATH typically parallel to the
document root using code similar to the following:

// Set INC_PATH.
ereg( "(.*)web_directory.*", $SCRIPT_FILENAME, $regs );
define( "INC_PATH", $regs[1] . "inc_directory/" );

Then I include files as follows:

include( INC_PATH . "inc_common.php" );

Very portable.

> I tried various versions of ../ and ../../ without success.

This isn't very portable anyway.  You don't want to have to change paths if
you move a file to a deeper subdirectory.

--
Steve Werby
COO
24-7 Computer Services, LLC
Tel: 804.817.2470
http://www.247computing.com/


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to