title: How to display same header and footer on different pages?
body: <p>I have header.php and footer.php files which I include in all of my pages. A sample page looks like this -</p>
  
  <pre><code>&lt;?php include($_SERVER['DOCUMENT_ROOT'].'/header.php');?&gt;
  
  &lt;div id="content"&gt;
  ...
  &lt;/div&gt; &lt;!-- content --&gt;
  
  &lt;?php include($_SERVER['DOCUMENT_ROOT'].'/footer.php') ?&gt;
  </code></pre>
  
  <p>Although this works well on the server, but when I test pages locally [ xampp on Windows 7 ], I get the following error message instead of the header, similarly for the footer -</p>
  
  <pre><code>Warning: include(C:/xampp/htdocs/header.php) [function.include]: failed to open stream: No such file or directory in C:\xampp\htdocs\f\index.php on line 1
  
  Warning: include() [function.include]: Failed opening 'C:/xampp/htdocs/header.php' for inclusion (include_path='.;C:\xampp\php\PEAR') in C:\xampp\htdocs\f\index.php on line 1
  </code></pre>
  
  <p>This makes testing very tedious as I have to upload to the server for every minor change.</p>
  
  <p>Also, I dug around the WP code, and it uses a get-header() to display the header.php file. I could not completely understand the function. My site does not use WP.</p>
  
  <p>What is the correct way for including header and footer files?</p>