That sounds complicated and like something I'd need to look at in detail to figure out.
But here's somewhere to start. If you're including the same file possibly into many files, then that can cause conflicts with paths.
My solution of choice is the following. It takes a little more time to type, but it works more smoothly.
PHP Code:
include(dirname(__FILE__).'/relative/path/to/my/file.php');
The __FILE__ magic constant contains the absolute path and name of the current file, even inside an included page. That will always be accurate.
dirname() just gets the directory name from __FILE__, so it's basically a way to get the current location.
Then you can add any relative path to it and never worry about where it's included from.
Note that __DIR__ is equivalent to dirname(__FILE__), but only in PHP 5.3+.
In short, this does use absolute paths, but it allows you to use relative paths. (It also makes it portable later if you want to move it [the whole group of files] to another location on your server, or to move everything to a new server.)
Does that help at all?
Bookmarks