title: Absolute paths within includes with localhost
body: <p>all.</p>
  
  <p>My question is in regards to a problem I'm encountering when trying to add a universal php template for my DOCTYPE section. My DOCTYPE include (aptly entitled doctype.php) lies within the /template directory, and also includes calls pointing to my CSS and JS files that I want to be accessible to all pages.</p>
  
  <p>So the problem is encountered when I try to write the absolute path to these files (the CSS and JS files). Currently, I am trying:</p>
  
  <pre><code>&lt;script type="text/javascript" src="&lt;?php echo $_SERVER['DOCUMENT_ROOT'] . '/file/extension/to/javascript/file.js'; ?&gt;"&gt;&lt;/script&gt;
  </code></pre>
  
  <p>and</p>
  
  <pre><code>&lt;link rel="stylesheet" type="text/css" href="&lt;?php echo $_SERVER['DOCUMENT_ROOT'] . 'file/extension/to/css/file.css'; ?&gt;"
  </code></pre>
  
  <p>I am running the application through WAMP on my localhost.
  Taking a look a look at the source code, it appears as though the links are pointing to the appropriate files (c:/wamp/www/examplesite/path/to/file/file.ext), and all should be well. BUT it is not...</p>
  
  <p>The JavaScript is not accessible and the Stylesheet is not functioning. I'm at a loss for what to do.</p>
  
  <p>I've also tried:
  -writing the absolute path without the use of PHP
  -creating PHP variables to hold the document root and then concatenating the appropriate directory path to access the files.</p>
  
  <p>Any suggestions? And how will this change when I upload the directory structure to my online server vs. my current localhost?</p>