If you want the navigation outside a mess of code you could use something like the following. This would allow for layering but still simple codeing. And I think a lot easier to understand when you check this code back in a year or so then using -2
and 2
menu.php
<?php
function AddMenuItem($url, $name)
{
$active_page = basename($_SERVER['PHP_SELF']);
if ($active_page == $url)
echo "<div class='active'>".$name."</div>";
else
echo "<a href='".$url."'>".$name."</a>";
}
?>
<ul>
<li>
<?php echo AddMenuItem("index.php", "Home"); ?>
</li>
<li>
<?php echo AddMenuItem("products.php", "Products"); ?>
<ul>
<li>
<?php echo AddMenuItem("ace.php", "Ace Blade"); ?>
</li>
<li>
<?php echo AddMenuItem("electrodes.php", "Electrodes"); ?>
</li>
<li>
<?php echo AddMenuItem("megasoft.php", "Mega Soft"); ?>
</li>
</ul>
</li>
<li>
<?php echo AddMenuItem("samples.php", "Samples"); ?>
</li>
</ul>
index.php, products.php, ace.php, etc.
<?php require_once("menu.php"); ?>