Re: Setting include path to same directory as .php file.?
| From: | Dan Lowe | Date: | Thu, 07 Dec 2000 05:54:57 +0000 |
| Subject: | Re: Setting include path to same directory as .php file.? | ||
| References: | 1 2 3 4 5 6 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-29066@lists.php.net to get a copy of this message | ||
Previously, Daniel Convissor said:
>
> I don't quite understand the implications of what you're saying.
> Regardless of where things are, you need to call the includes relative to
> the directory where the initial page is called from. As mentioned in a
> reply to another post of yours on this subject, I suggest using variables
> set in the initial file then using that variable name in all subsequent
> include requests.
>
> If I'm misunderstanding you, please post clarification to the list.
Well, I may be misunderstanding you also, but here's some more info.
Basically, there is the package called PHP-Nuke (www.phpnuke.org) and I
have a smaller package MiG (www.tangledhelix.com/software/mig) and I have
created a plugin "mode" for my package to be an add-on for PHP-Nuke.
The issue was that the initial version dumped itself, potentially, in the
root directory of the PHP-Nuke install. That doesn't work out very well
because admittedly my installer likes to litter a bit. So the best thing
to do is to have it in a subdirectory (such as {root}/mig/) so that I do
not interfere with or trample on anything in the PHP-Nuke root directory.
My script, when in compatibility mode, include()'s some PHP-Nuke standard
files with very simple calls:
if ($phpNukeMode)
include("../header.php");
[... other stuff...]
if ($phpNukeMode)
include("../footer.php");
The problem is that header.php goes on to include other files itself, and
it is assuming they'll be in "." or in include_path (neither of which is
"../". So it doesn't work.
Since I don't control the files I am including, there's nothing I can do to
make them use a different path to include the files they are including.
What I've done for now is leave the 'main' bit of my code in the PHP-Nuke
root and isolate the rest of the package into a subdirectory. But ideally
I would rather have everything of mine in a subdirectory, if possible.
I hope that clears up any confusion from my earlier posts.
-dan
--
Dan Lowe <dan@tangledhelix.com> http://tangledhelix.com/
Do infants enjoy infancy as much as adults enjoy adultery?
-George Carlin