I have a big ask!
I need to turn this menu into a drop down menu system.
Does anyone have a clue how?
joe@mbdesign.com.au
// -------------------------------------------------------------
// Show the Main Menu
// -------------------------------------------------------------
function showMainMenu($menu_format) {
global $pg, $add_parent_id, $t_parent_id, $url_path;
if(!$t_parent_id) {
$c_sql = "SELECT item_id, item_name, item_image, sort_nbr, url_out, parent_id from dot_pages".
" WHERE parent_id = 1 AND status = \"Publish\" ORDER BY sort_nbr";
} else {
$c_sql = "SELECT item_id, item_name, item_image, sort_nbr, url_out, parent_id from dot_pages".
" WHERE parent_id = 1 AND status = \"Publish\" ORDER BY sort_nbr";
}
$c_items = mysql_query($c_sql);
$num_items = mysql_num_rows($c_items) + 1;
if($num_items == 0) {
$cell_pct = "100%";
} else {
$cell_pct = (100 / $num_items);
}
if (!$c_items) {
echo("<P>There is a problem with getting the children records.<BR>Error: " . mysql_error());
exit();
}
$main_menu = "<div class=\"MAINMENU\">";
$main_menu_wide = "<table class=\"MENUTABLE\"><tr valign=\"top\">";
while ($c_item = mysql_fetch_array($c_items)) {
$c_item_id = $c_item["item_id"];
$c_item_name = $c_item["item_name"];
$item_image = $c_item["item_image"];
$c_url_out = $c_item["url_out"];
$c_sort_nbr = $c_item["sort_nbr"];
$c_parent_id = $c_item["parent_id"];
if($c_url_out == "") {
if(!$item_image) {
$main_menu .= "<a class=\"MAINMENUITEM\" href=\"".$url_path."index.php/".$c_item_id."\">".$c_item_name."</a><br><br>\n";
$main_menu_wide .= "<td nowrap width=\"\"><a class=\"MAINMENUITEM\" href=\"".$url_path."index.php/".$c_item_id."\">".$c_item_name."</a> </td>\n";
} else {
include("includes/convert_imageinfo.inc");
$main_menu .= "<a class=\"MAINMENUITEM\" href=\"".$url_path."index.php/".$c_item_id."\">".$item_image."</a><br><br>\n";
$main_menu_wide .= "<td nowrap width=\"".$cell_pct."%\"><a class=\"MAINMENUITEM\" href=\"".$url_path."index.php/".$c_item_id."\">".$item_image."</a></td>\n";
}
} else {
if(!$item_image) {
$main_menu .= "<a class=\"MAINMENUITEM\" href=\"".$url_path."redirect.php?go=$c_url_out\">$c_item_name</a><br><br>";
$main_menu_wide .= "<td nowrap width=\"".$cell_pct."%\"><a class=\"MAINMENUITEM\" href=\"".$url_path."redirect.php?go=$c_url_out\">$c_item_name</a></td>";
} else {
include("includes/convert_imageinfo.inc");
$main_menu .= "<a class=\"MAINMENUITEM\" href=\"".$url_path."redirect.php?go=$c_url_out\">$item_image</a><br><br>";
$main_menu_wide .= "<td width=\"".$cell_pct."%\"><a class=\"MAINMENUITEM\" href=\"".$url_path."redirect.php?go=$c_url_out\">$item_image</a></td>";
}
}
}
$main_menu .= "</div>";
$main_menu_wide .= "</tr></table>";
if($menu_format == "stacked") {
return $main_menu;
} else {
return $main_menu_wide;
}
}