Problem locating files in file system using php.
I am building a site using WAMP in windows 7 and I am having problems locating my css and image folder in my sub directories.
I have multiple index.php files. I have 1 index.php file in the root of my site and also multiple sub folders which their own index.php file as well. I am using the "require_once" function to include header.php, footer.php, sidebar.php, etc and and all my index.php files are using these same included files regardless what level they're in in my folder tree.
The problem is with my header.php file; because that is the file I'm using to link to my css stylesheet. I am successfully able to find the css file in my root index.php file but all my sub-folder index.php files ere not finding it.
I've already discovered that by going into my header.php file and put a "../" in front will successfully work for all my sub-folder index.php files, but then my root index.php file doesn't find the css stylesheet anymore, and visa-versa.
How can I get all my index.php files to see the css file regardless how deep or shallow they are in my file directory?
I already know how to solve this problem if my site was already live on the internet, but I don't know how to solve it while I'm building it locally in WAMP. Can someone please help me? I hope I didn't confuse anyone...
So if, for instance, you have your WAMP config set up such that your web document root is at C:\Wamp\www, that would look for the include file as C:\Wamp\www\path\to\file.php.
include $_SERVER['DOCUMENT_ROOT'] . '/path/to/file.php';
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Tags for this Thread