title: PHP includes and subfolder
body: <p>I've create an application which uses PHP includes which works great if you don't mind having the PHP include files in the same place as the other files.  But I would like to split my code up as neatly as possible.  Please see the below file structure:</p>
  
  <p><a href="http://beginsathome.org.uk/BAAF/images/file_system.png" rel="nofollow noreferrer">http://beginsathome.org.uk/BAAF/images/file_system.png</a></p>
  
  <p>As you can, I would like all ?.php files to be in the document root and for all php-related include files (eg. database connection details) to be in the 'inc' folder.</p>
  
  <p>For the html and corresponding css, images etc, I created a 'templates' folder to hold all the details with a sub-folder called 'includes' which will hold the html includes such as header, footer etc.</p>
  
  <p>Unfortunately, even though my images and css are in the same place as my html templates, the css and images don't seem to show when viewing the site (although the text part of the header/footer do).</p>
  
  <p><a href="http://www.beginsathome.org.uk/BAAF/images/screenshot.png" rel="nofollow noreferrer">http://www.beginsathome.org.uk/BAAF/images/screenshot.png</a></p>
  
  <p>Ive been trying to do some research and understand that using something like </p>
  
  <pre><code>
  $path = $_SERVER['DOCUMENT_ROOT'];
     $path .= "/common/header.php";
     include_once($path);
  </code></pre>
  
  <p>might be a way forward, but i am new to PHP and wasn't sure where to put it, or which route to specify.  I also understand that this method can vary depending on whether it is on an apache, linux or windows server.  ideally i want the method to work on all servers.  I am currently developing on a local apache server on a mac.</p>
  
  <p>Thanks very much for your help
  Theresa</p>