nu er tabeller ikke beregnet til design, men men til tabulære data, men hurtig tilretning:
index.php, examples.php osv
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<title></title>
<link rel="stylesheet" href="menu.css" />
</head>
<body>
<?php
include "menu.php";
?>
</body>
</html>
menu.php
<div id="menubar">
<table id="menutable">
<?php
$dirs = explode('/', $_SERVER['PHP_SELF']);
$size = sizeof($dirs)-1;
$menu = array(
// bør nok være array("parth","index.php","Home"), hvis parth er forskellig
array("index.php","Home"),
array("examples.php","Examples"),
array("page.php","A Page"),
array("another_page.php","Another Page"),
array("contact.php","Contact Us")
);
$lng = count($menu);
for ($i=0; $i<$lng; $i++){
if($menu[$i][0] == $dirs[$size]){
echo '<tr>';
echo '<td class="selectet"><a href="'.$menu[$i][0].'">'.$menu[$i][1].'</a></td>';
echo '</tr>';
echo "\n";
}
else{
echo '<tr>';
echo '<td><a href="'.$menu[$i][0].'">'.$menu[$i][1].'</a></td>';
echo '</tr>';
echo "\n";
}
}
?>
</table>
</div>
menu.css
a:hover{
background-color:yellow;
}
.selectet{
background-color:red;
}
#menutable{
width: 100%:
}