When you start including one file within another file, yes I can understand your frustration.
My suggestion is to plan ahead and view your development as a framework. By doing so, you force yourself to layout your directory structure and force yourself to build reusable code you can leverage.
For example, on my physical disk I lay it out as follows:
Common class routines
/MyFramework
/MyFramework/Db
/MyFramework/TimeDate
/MyFramework/Xml
/MyFramework/XmlRpc
Blog application
/Blog
/Blog/Images
/Blog/Errors
/Blog/Theme
Portal application
/Portal
/Portal/Images
/Portal/Errors
/PortalTheme
etc.
I store all this on the document root of my webserver. Then, to get at the files, I simply issue the following and build a path from that location:
$_SERVER["DOCUMENT_ROOT"];
To avoid putting in too many hard coded directory locations inside my source, I create a global.php file and include it in every .PHP file.
Global.php
$docRoot = $_SERVER["DOCUMENT_ROOT"];
define(MYFRAMEWORK, $docRoot . "/MyFramework");
define(BLOG, $docRoot . "/Blog");
define(PORTAL, $docRoot . "/Portal");
If you later move the directories, you can simply change the define instead of updating all your source code files in global.php.
You can also put in this global.php file includes/requires that are needed everywhere. For example, I have an object framework that every class inherits from.
I include my framework module in Global.php as so:
Global.php
$docRoot = $_SERVER["DOCUMENT_ROOT"];
define(MYFRAMEWORK, $docRoot . "/MyFramework");
define(BLOG, $docRoot . "/Blog");
define(PORTAL, $docRoot . "/Portal");
require_once(MYFRAMEWORK . "/core.php");
And put it in all my applications like so:
<?php include("Global.php") ?>
<html>
<head><title>Test</title</head>
<body>
<?php do some php stuff here ?>
</body>
</html>
Hope this helps.