I've really been banging my head on the wall with this one. WHen I built my first PHP site a few months ago, I used this little snippet to handle my includes:
<?php include($_SERVER["DOCUMENT_ROOT"].'/_includes/components/header.php'); ?>
It worked perfectly - any page in any directory could use the same code to get to the include.
Now I have another PHP site to build, so I set up two Virtual Hosts in Apache. Each site now lives in its own directory within the htdocs directory. But now, my nice include code, above, no longer works. The code above resolves to the htdocs directory, instead of the the Virtual Host directory.
How can I code my includes to resolve to the root of the Virtual Host directory? Please help!