I was wondering if there was anyway of changing this for the better, and to see if it is of some quality
<?
function menu($page) {
function dropmenu() {
// Create Function/Variable For Drop Down Menu
$menu_list = array(
"Blogs", "Art", "Pictures", "Forum", "Guestbook", "Poll",
"Tell A Friend", "Store", "Links", "About", "Contact", "Donate", "Admin"
); // Array Of Drop Down Items
// Start Putting String Together, Starting With Form Tags
$dropmenu = "<p><form name=\"otherpages\" action=\"/other.php\" method=\"GET\">\n";
$dropmenu .= "<select name=\"go\" size=\"1\" class=\"user\" onChange=\"document.otherpages.submit()\">\n";
$dropmenu .= "<option selected>Other Pages..</option>\n";
for ($i=0;$i<count($menu_list);$i++) {
// Loop Through The Array To Build The String And Drop Down List
$dropmenu .= "<option>".$menu_list[$i]."</option>\n";
}
// Finish Putting Together The String
$dropmenu .= "</select> \n";
$dropmenu .= "<input type=\"submit\" value=\"GO\" class=\"user\">\n";
// Return $dropmenu For Echoing
return $dropmenu;
}
// Array Of Arrays Of Main Urls
// Format - (Link Mask, Url, Rollover Effect (1=On,2=Off), Open Link In New Window)
$array = array("1" =>
array("1" => "Home", "/index.php", 1, 0),
array("1" => "Ringtones", "http://ringtones.".$_SESSION['host_ad']."/", 1, 1),
array("1" => "Trick-Tips", "/trick-tips.php", 1, 0),
array("1" => "Games", "/games.php", 1, 0),
array("1" => "Jokes", "/jokes.php", 1, 0),
array("1" => "Waypoints", "/waypoints.php", 1, 0),
array("1" => dropmenu($page), 0, 1, 0)
);
$listnum = count($array) + 1; // Add One To Tell The For Loops When To Stop
for ($i=1;$i<$listnum;$i++) {
if ($i == $page) {
// Change The Rollover Effect To Suit The Page
$array[$i][3] = 2;
}
}
// Start Putting Together The Menu
$display = "";
for ($i=1;$i<$listnum;$i++) {
// Decide Wether Or Not To Use The Rollover Effect Or Not
if ($array[$i][3] == 2) {
$rollover = "class=\"highlight\"";
}
else {
$rollover = "class=\"normal\" onMouseOver=\"this.className='highlight'\" onMouseOut=\"this.className='normal'\"";
}
// If Url Equals 0 Then Dont Create A Hyperlink
if ($array[$i][2] == "0") {
$display .= "<td align=\"center\" ".$rollover." ";
$display .= "><p>".$array[$i][1]."</td>\n";
}
else {
$display .= "<td align=\"center\" ".$rollover." ";
$display .= "><p><a href=\"".$array[$i][2]."\" class=\"nav\" ";
// Open Link In New Window
if ($array[$i][4] == 1) {
$display .= "target=\"_BLANK\"";
}
$display .= ">".$array[$i][1]."</a></td>\n";
}
}
// Finish Menu
$display .= "</form>\n";
// Return $display For Echoing
return $display;
}
?>
all suggestions, and comments accepted 🙂