Simple question?
I have a file which includes another.
For instance, "/main.php" includes
"/a/b/c/d/functions.php"
So far, so good. Even when functions.php gets
moved later, I can include it with
"include '/e/f/g/h/functions.php';"
Problem: now I want to break functions.php
into smaller, more manageable parts.
They will live in the same directory as
functions.php. I want main.php to keep the same "include" statements, and then have functions.php
simply include the pieces it needs.
Something like
include './part1.php';
include './part2.php';
(etc.)
But this thinks the paths are relative to
main.php (/) not functions.php (/a/b/c/d).
Using dirname($PHP_SELF) yields the same
problem; the code thinks $PHP_SELF refers
to main.php, not functions.php. There MUST
be a simple automatic way to handle this
(beyond setting a global path variable
to where functions.php lives, and using
that in functions.php). Any ideas? Or
must I just add that silly global path
variable? Seems clunky.