Re: Re: Include path quirks

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Ethilien wrote:
Actually, I think I might have found a solution, although its not a very good one.

include realpath(dirname(__FILE__) . "/" . "../include/global.php");

alot of people do something _like_:

define('GLOBAL_BASE_DIR', dirname(__FILE__));

somewhere near the beginning of their startup code...
so you can subsequently do:

require_once GLOBAL_BASE_DIR . '/include/xyz.php';

but maybe you should also look at the ini setting 'include_path'


Ethilien wrote:

I've been attempting to write an application with a bit more ordered directory structure than I normally use, and I ran into the rather annoying problem with include() where relative paths are only based off of the current working directory, and not that of the included script. This makes it impossible to include script correctly, because the path from the working directory is different than that of the included file.

The problem is I'm trying to include
/include/global.php

from
/elements/nav.php

but topnav is included by
/index.php

Which results in a failed top open stream error. Is there any way around this annoying idiosyncrasy?



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux