I have a bit of a mess of a file system here at work, and trying to code around it is driving me crazy. Hopefully someone here can help. First, some background.
We have multiple domains on two different servers (one is Windows, the other Linux). The goal is to build a form that can be included on any of the domains. We already have this by having two copies of the form, one on each of the servers, and using server absolute paths to include the form.php file (include "/etc/www/formhostingdomain/form.php"; and include "D:\www\formhostingdomain2\form.php" for example). Like I said, this part works.
Now where I am getting into problems is that the form.php file needs to dynamically include some more files from the same folder as it is in. I've tried relative references, as well as server absolute paths for this, but I can't seem to get it working. A single server absolute include inside of form.php (such as include 'D:\www\formhostingdomain2\formextras.php';) works, but if I try something like
$server_path = "D:\\www\\formhostingdomain2\\";
include $server_path."formextras.php";
then I can't get it to include properly. I need to be able to move the server path into a single variable because there are too many includes throughout the file to be maintainable otherwise. I've tried playing with single quotes vs double quotes, and single, double, and even quadruple backslashes, as well as forward slashes, all to no avail. I've also read the documentation at http://php.net/manual/en/language.types.string.php but that didn't shine any light on the situation for me. I'm sure there's just something subtle I'm missing.