Location: PHPKode > scripts > alarisMenu > alarismenu/alarisMenu.php
<?
/********************************************************************
alarisMenu
Mysql driven DHTML menu generator written in PHP and JavaScript
Copyright (c) 2002 Rasmus L. Petersen @ http://www.alaris.dk
You are free to use and change this script as long as this message
and ALL copyright messages are intact!
Available at http://www.alaris.dk
*********************************************************************/

echo "\n\n<!-- ******************************************* -->\n";
echo "<!-- *  alarisMenu developed @ www.alaris.dk   * -->\n";
echo "<!-- *  Copyright (c)2002 Rasmus L. Petersen   * -->\n";      
echo "<!-- ******************************************* -->\n\n\n";




include("./settings.inc.php");
$menu_number = count($menu);
$dist = $alaris_left;
for($i=0;$i < $menu_number;$i++){
$menu_width[$i] =  $menu[$i]->WIDTH;
$menu_left[$i] = $dist;
$dist = $dist + $menu_width[$i];
}

/* CREATING THE MAIN MENU */

unset($output);
$output = "";

$output .= "<table width=\"$alaris_width\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">
	    <tr bgcolor=\"$alaris_bgcolor\"><td width=\"1\">&nbsp;</td>";

for($i=0;$i < $menu_number;$i++){
$output .= "<td width=\"".$menu[$i]->WIDTH."\" align=\"center\" onMouseOver=\"bgColor='".$alaris_mocolor."'\" onMouseOut=\"bgColor='".$alaris_bgcolor."'\">
	   <a class=\"menu\" href=\"".$menu[$i]->URL."\" target=\"".$menu[$i]->TARGET."\" onMouseOver=\"window.status='".$menu[$i]->TITLE."'; show('Menu".$i."',1,this,$menu_left[$i]); return false;\">
	   <span>".$menu[$i]->TITLE."</span></a></td>";
}
$output .= "<td>&nbsp;
	    </td>
	    </tr>
	    </table>";

echo $output;


/* THE JAVASCRIPT */
?>

<script language="javascript">
if (window.innerWidth) {
	 ScreenW = window.innerWidth
}
else if (document.body) {
	if (document.body.clientWidth) {
		ScreenW = document.body.clientWidth
	}
}

function makeWindow(LayerName, height, left, width) {

document.write('<DIV CLASS="" ID="' + LayerName +'" STYLE="POSITION: absolute; VISIBILITY: hidden; Z-INDEX: 21; TOP:<?=$alaris_top;?>px; LEFT: ' + Math.abs(ScreenW/2 + left) +'px; WIDTH: 10px; HEIGHT: ' + height +'px;"><DIV>');
}

</script>
<?
/* THIS IS THE SUBMENUES */

unset($string);
$string = "";

for($i=0;$i < $menu_number;$i++){
	
$string .= "
	    <script>
            makeWindow('Menu".$i."', 0, $menu_left[$i], 0);
            </script>
            <table class=\"border\" bgcolor=\"$alaris_sub_bgcolor\" width=\"$alaris_subtable_width\" cellpadding=\"0\">";
            	
	for($j=0;$j < count($submenu[$i]);$j++){
          
	$string .= "<tr>
		      <td align=\"left\" onMouseOver=\"bgColor='".$alaris_sub_mocolor."'\" onMouseOut=\"bgColor='".$alaris_sub_bgcolor."'\">
		      <a class=\"submenu\" href=\"".$submenu[$i][$j]->URL."\" target=\"".$submenu[$i][$j]->TARGET."\"><span>".$submenu[$i][$j]->TITLE."</span></a></td>
		    </tr>";
	}

$string .= "</table>
	    </div>
            </div>";
}
echo $string;
?>
Return current item: alarisMenu