Using the include function in template down the directory <p>I wish to use header (includes css, js and images) and footer files located in a folder called /template. These files then get included in every file down the directory for example:</p> <pre><code>/template/header.php + footer.php /home/index.php /products/products.php /products/hardware/types/hardware.php /css /js /images </code></pre> <p>When i use:</p> <pre><code>include (__DIR__ . "/../template/header.php"); </code></pre> <p>The file is included (although i need to change each file and ad more "/../" the further down the directory i go) but all the css, js and images are broken.</p> <p>here is my header (located in header.php, one of the included files):</p> <pre><code>&lt;head&gt; &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt; &lt;link rel="shortcut icon" href="images/favicon.ico"&gt; &lt;link rel="icon" type="image/gif" href="images/favicon.ico"&gt; &lt;link rel="stylesheet" type="text/css" href="../css/layout.css"/&gt; &lt;link rel="stylesheet" type="text/css" href="../css/slider.css"/&gt; &lt;link rel='stylesheet' type='text/css' href='../css/menus.css'/&gt; &lt;link rel='stylesheet' type='text/css' href='../css/forms.css'/&gt; &lt;link rel="stylesheet" href="css/jquery-ui.css" type="text/css" media="all"/&gt; &lt;script type="text/javascript" src="../js/jquery.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="../js/jquery.elastic.source.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="../js/control.js"&gt;&lt;/script&gt; &lt;title&gt;APEC Energy - &lt;?php echo($PageTitle);?&gt; &lt;/title&gt; &lt;/head&gt; </code></pre> <p>I am now trying to use a config file (which is hard to get working and still doesnt for me).</p> <p>config.php (placed in root folder):</p> <pre><code>&lt;?php $paths = array( "root" =&gt; "./", "controller" =&gt; "controller", "stylesheets" =&gt; "css", "images" =&gt; array(...), "javascript" =&gt; array(...), ); $projectName = "/"; function fInc($filePath){ global $projectName; return '//'.$_SERVER['HTTP_HOST'].'/'.$projectName.'/'.$filePath; } ?&gt; </code></pre> <p>and in each .php file calling for the including file im using:</p> <pre><code>&lt;?php $rootDir = $_SERVER['DOCUMENT_ROOT']."/".(explode ('/', $_SERVER['PHP_SELF'])[1]); require_once($paths['helper']['html']."template/header.php"); ?&gt; </code></pre> <p>When i use var_dump($paths), it prints out "NULL"</p> <p>but just get a blank screen now?</p>