Jump to content

Css menus generated by php and mysql aren't displaying at all


cturner

Recommended Posts

I am trying to add hotspots to buttons then display a menu for each button. Well the hotspots are displaying all right but the menus just aren't displaying, no matter what I do. The menus must match each button. So can someone please have a look at my code and table structure which is below, and tell me why the menus aren't displaying? I yet to test whether the submenus are going display. Thanks in advance. I am really desperate for an answer. I have been working on this for too long.

 

// display the buttons with menus
$query6 = mysql_query("SELECT * FROM menu WHERE menuname != 'Alone' AND menu != 'Yes'") or die ("Could not query because: ".mysql_error());
while ($row6 = mysql_fetch_array($query6)) {
$pagetitle1 = str_replace('%20', '', $row6['pagetitle']);
$pagetitle2 = strtolower($pagetitle1);
$pagetitle3 = stripslashes($pagetitle2);
$pagetitle4 = str_replace('%20', ' ', $row6['pagetitle']);
$pagetitle5 = $row6['pagetitle'];
echo "<img name=\"".$pagetitle3."btn\" src=\"http://www.blueguminteractive.biz/bdgp/admin/images/".$pagetitle3."btn.jpeg\" width=\"110\" height=\"23\" border=\"0\" id=\"".$pagetitle3."btn\" usemap=\"#m_".$pagetitle3."btn\" alt=\"".$pagetitle4."\">\n";
echo "<map name=\"m_".$pagetitle3."btn\" id=\"m_".$pagetitle3."btn\">\n";		
echo "<area shape=\"rect\" coords=\"0,0,76,18\" href=\"page.php?page=".$pagetitle5."\" alt=\"".$pagetitle4."\" onmouseout=\"MM_menuStartTimeout(1000);\"";
echo " onmouseover=\"MM_menuShowMenu('MMMenuContainer".$row6['mainid']."_".$row6['menuid']."', 'MMMenu".$row6['mainid']."_".$row6['menuid']."',0,23,'".$pagetitle3."btn');\">\n";
echo "</map>\n";		

// display the menus
$query06 = mysql_query("SELECT * FROM menu WHERE menu = 'Yes' AND pagetitle = '$pagetitle5'") or die ("Could not query because: ".mysql_error());
while ($row06 = mysql_fetch_array($query06)) {			
	echo "<div id=\"MMMenuContainer".$row06['mainid']."_".$row06['menuid']."\">\n";
	echo "<div id=\"MMMenu".$row06['mainid']."_".$row06['menuid']."\" onmouseout=\"MM_menuStartTimeout(1000); \" onmouseover=\"MM_menuResetTimeout();\">\n";
	echo "<a href=\"page.php?page=".$row06['menuname']."\" id=\"MMMenu".$row06['mainid']."_".$row06['menuid']."_Item_".$row06['menuid']."\" class=\"MMMIFVStyleMMMenu".$row06['mainid']."_".$row06['menuid']."\" onmouseover=\"MM_menuOverMenuItem(\'MMMenu".$row06['mainid']."_".$row06['menuid']."\');\">".$row06['menuname']."</a>\n";
	echo "<a href=\"page.php?page=".$row06['menuname']."\" id=\"MMMenu".$row06['mainid']."_".$row06['menuid']."_Item_".$row06['subid']."\" class=\"MMMIVStyleMMMenu".$row06['mainid']."_".$row06['menuid']."\" onmouseover=\"MM_menuOverMenuItem('MMMenu".$row06['mainid']."_".$row06['menuid']."');\">".$row06['menuname']."</a>\n";
	echo "</div>\n";
	echo "</div>\n";

// display the sub menus
$query07 = mysql_query("SELECT * FROM menu WHERE submenu = 'Yes' AND submenuname != 'none'") or die ("Could not query because: ".mysql_error());
while ($row07 = mysql_fetch_array($query07)) {
	$pagetitle05 = str_replace('%20', '', $row07['pagetitle']);
	$pagetitle06 = strtolower($pagetitle05);
	$pagetitle07 = stripslashes($pagetitle06);
	$pagetitle08 = str_replace('%20', ' ', $row07['pagetitle']);
	echo "<div id=\"MMMenuContainer".$row07['mainid']."_".$row07['menuid']."\">\n";
	echo "<div id=\"MMMenu".$row07['mainid']."_".$row07['subid']."\" onmouseout=\"MM_menuStartTimeout(1000); \" onmouseover=\"MM_menuResetTimeout();\">\n";
	echo "<a href=\"page.php?page=".$row07['pagetitle']."\" id=\"MMMenu".$row07['mainid']."_".$row07['subid']."_Item_".$row07['menuid']."\" class=\"MMMIFVStyleMMMenu".$row07['mainid']."_".$row07['subid']."\" onmouseover=\"MM_menuOverMenuItem('MMMenu".$row07['mainid']."_".$row07['subid']."',\'".$row07['subid']."\');\">\n";
	echo "<span class=\"MMMenuItemSpanMMMenu".$row07['mainid']."_".$row07['subid']."\">".$row07['pagetitle']."</span>";
        echo "<img src=\"arrows.gif\" class=\"MMArrowStyleMMMenu".$row07['mainid']."_".$row07['subid']."\">\n";
        echo "</a>\n";
	echo "</div>\n";
	echo "<div id=\"MMMenu".$row07['mainid']."_".$row07['subid']."_".$row07['subid']."\" onmouseout=\"MM_menuStartTimeout(1000);\" onmouseover=\"MM_menuResetTimeout();\">\n";
	echo "<a href=\"page.php?page=".$row07['pagetitle']."\" id=\"MMMenu".$row07['mainid']."_".$row07['subid']."_".$row07['subid']."_Item_".$row['menuid']."\" class=\"MMMIFVStyleMMMenu".$row07['mainid']."_".$row07['subid']."_".$row07['subid']."\" onmouseover=\"MM_menuOverMenuItem('MMMenu".$row07['mainid']."_".$row07['subid']."_".$row07['subid']."');\">\n";
	echo $row07['pagetitle'];
	echo "</a>\n";
	echo "</div>";
	}
}
}

 

Here is my table structure:

Menu // The name of the table

menuid // The auto_increment primary key number. Also used in the css menus with the ids and classes.

menu // Yes or no. To determine whether a button should have a menu.

menuname // Alone, menu or pagetitle. To determine whether a button should have a hotspot and menu.

pagetitle // Pagetitle is just the pagetitle.

subid // For the css menus. Used in the css menus with the ids and classes.

submenu // Yes or no.

submenuname // None or pagetitle.

mainid // For css menus. Used in the css menus with the ids and classes.

 

I hope this is enough information to help you.

Link to comment
Share on other sites

Okay I have got the menus to display but they are not the right ones for each button. This rather urgent that I get this completed.

 

Here is my updated code:

// display the buttons with menus
$query6 = mysql_query("SELECT * FROM menu WHERE menuname != 'Alone' AND menu != 'Yes'") or die ("Could not query because: ".mysql_error());
while ($row6 = mysql_fetch_array($query6)) {
	$pagetitle1 = str_replace('%20', '', $row6['pagetitle']);
	$pagetitle2 = strtolower($pagetitle1);
	$pagetitle3 = stripslashes($pagetitle2);
	$pagetitle4 = str_replace('%20', ' ', $row6['pagetitle']);
	$menuname = $row6['menuname'];
	echo "<img name=\"".$pagetitle3."btn\" src=\"http://www.blueguminteractive.biz/bdgp/admin/images/".$pagetitle3."btn.jpeg\" width=\"110\" height=\"23\" border=\"0\" id=\"".$pagetitle3."btn\" usemap=\"#m_".$pagetitle3."btn\" alt=\"".$pagetitle4."\">\n";
	echo "<map name=\"m_".$pagetitle3."btn\" id=\"m_".$pagetitle3."btn\">\n";		
	echo "<area shape=\"rect\" coords=\"0,0,76,18\" href=\"page.php?page=".$row6['pagetitle']."\" alt=\"".$pagetitle4."\" onmouseout=\"MM_menuStartTimeout(1000);\" onmouseover=\"MM_menuShowMenu('MMMenuContainer".$row6['mainid']."_".$row6['menuid']."', 'MMMenu".$row6['mainid']."_".$row6['menuid']."',76,0,'".$pagetitle3."btn');\">\n";		
	echo "</map>\n";	

	// display the menus
	$query06 = mysql_query("SELECT * FROM menu WHERE menuname = '$menuname'") or die ("Could not query because: ".mysql_error());
	while ($row06 = mysql_fetch_array($query06)) {
			echo "<div id=\"MMMenuContainer".$row06['mainid']."_".$row06['menuid']."\">\n";
			echo "<div id=\"MMMenu".$row06['mainid']."_".$row06['menuid']."\" onmouseout=\"MM_menuStartTimeout(1000); \" onmouseover=\"MM_menuResetTimeout();\">\n";
			echo "<a href=\"page.php?page=".$row06['pagetitle']."\" id=\"MMMenu".$row06['mainid']."_".$row06['menuid']."_Item_".$row06['menuid']."\" class=\"MMMIFVStyleMMMenu".$row06['mainid']."_".$row06['menuid']."\" onmouseover=\"MM_menuOverMenuItem(\'MMMenu".$row06['mainid']."_".$row06['menuid']."\');\">".$row06['pagetitle']."</a>\n";
			echo "</div>\n";
			echo "</div>\n";
	}
}

Link to comment
Share on other sites

Problem solved. :) The solution was to change my table structure to this:

Menu

menuid

menu

pagetitleMenu // to display the buttons with the menus

pagetitle2 // to display menus

pagetitleSub // to display the sub menus

subid

submenu

mainid

 

If you need more information on the table structure please the beginning of this thread.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.