How can I reference my classes in other directories without broken links?

I've got several apps that I'm building within my web community. Recently, just to keep things a little more organized, I'm creating a separate directory for each app.

My stylesheet is located in the "css" directory in my root folder. So when I reference it using "../css/new_style.css," unless all of my images were referenced as absolute URLs rather than relative URLs, I ran into a problem.

I've got some classes in my root directory as well and here's where I'm running into a problem. For example, if I do "require_once('projectpageclass.php');," I get an error that says a DBaux.xml can't be found. Take a look at what this looks like below...

Instead of duplicating htmlclass.php and projectpageclass.php in my "app" directory, I want to simply call them like "require_once('../htmlclass.php')" etc. But when I do that, the error that I referenced earlier pops up as far as "DBAux.xml" can't be found.

If I'm on a page within my "html" directory, no problem. When I attempt to reference my classes from the "app" directory, things break down.

Is there a way to reference that class that preserves the "hierarchy" so my links don't break? Or do I simply need to ensure that any link within those classes is an absolute link rather than a relative one?
Bruce GustPHP DeveloperAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Ray PaseurCommented:
Have a look at the PHP autoloader standard.  It's pretty well understood and debugged.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.