I have header.php
with the following code:
<?php include('config.php');?>
<body>
<header>
<nav>
<ul>
<?php
echo "<li><a href=\"$root/index.php\">Home</a></li>";
?>
</ul>
</nav>
</header>
This is my index.php
:
<?php
include('include/head.php');
include('include/header.php');
?>
<h1>whattup</h1>
</body>
</html>
Since I included config.php
in the header.php
which contains a $root
variable, I would assume it is also automatically included to the index.php
. Why isn't this the case? The solution that works is to include the config to index.php
but I feel like that is redundant if I already included that into the header.php