PHP/MySQL driven menu

Having problems with DHTML Menu? There is usually somebody here who knows the answer.
Post Reply
Googolplex
Super Advanced
Super Advanced
Posts: 50
Joined: Tue Nov 05, 2002 9:09 pm

PHP/MySQL driven menu

Post by Googolplex »

Does anyone have an example of a PHP/MySQL driven menu ?
User avatar
John
 Team
 Team
Posts: 5967
Joined: Sun May 19, 2002 8:23 pm
Location: Phoenix, AZ
Contact:

Post by John »

Take a look at the main site at http://milonic.com/ (I know, you can't see the code, but you'll see some of what can be done), and/or do a search for those items. You will find a lot of stuff. Many folks here using that combo.
John
Googolplex
Super Advanced
Super Advanced
Posts: 50
Joined: Tue Nov 05, 2002 9:09 pm

Post by Googolplex »

I am sorry, but I don't understand what you mean, since I cannot see the server-side code, how can that be of any help to me ?

What should I search for ?
User avatar
Andy
Milonic
Milonic
Posts: 3308
Joined: Sun May 19, 2002 8:23 pm
Location: Menu Developer
Contact:

Post by Andy »

A demo of how to build menus in PHP from a database will be coming soon, once I can the other Million and one things done :)

Should hopefully see something soon.

Cheers
Andy.
Googolplex
Super Advanced
Super Advanced
Posts: 50
Joined: Tue Nov 05, 2002 9:09 pm

Post by Googolplex »

Sounds great, I will look forward to that :P
System7
Advanced
Advanced
Posts: 10
Joined: Fri Nov 07, 2003 8:38 pm

Post by System7 »

this might help
this is what is on the page where i have my menu

Code: Select all

$sql = "SELECT * FROM menu WHERE menuname = 'mainmenu'";
    	    $result = mysql_query($sql);
			while ($row = mysql_fetch_row($result))  {
				if ($row[4] != ""){ //row[4] = showmenu, if showmenu!="" then
					echo "<a href=\"$row[3]\" class=\"menu\" onmouseover=\"popup('$row[4]',1)\" onmouseout=popdown()>$row[2]</a>\n";
				}
				else { //row[4] = showmenu, if showmenu="" then 
					echo "<a href=\"$row[3]\" class=\"menu\">$row[2]</a>\n";
				}
			}
this is what is in my menu_data.php page

Code: Select all

<?
	$connect = mysql_connect("localhost","root","") or die("Unable to connect to your newbish db");
	$db = mysql_select_db("prairies", $connect);   
?>

_menuCloseDelay=500           // The time delay for menus to remain visible on mouse out
_menuOpenDelay=150            // The time delay before menus open on mouse over
_followSpeed=5                // Follow scrolling speed
_followRate=40                // Follow scrolling Rate
_subOffsetTop=10              // Sub menu top offset
_subOffsetLeft=-10            // Sub menu left offset
_scrollAmount=3               // Only needed for Netscape 4.x
_scrollDelay=20               // Only needed for Netcsape 4.x


with(menuStyle=new mm_style()){
onbgcolor="#EDEDED";
oncolor="#000000";
offbgcolor="#3D3D3D";
offcolor="#E5E5E5";
padding=1;
fontsize=11;
fontstyle="normal";
separatorsize=10;
separatorcolor="#3D3D3D";
fontfamily="Arial Narrow";
subimage="images/arrow.gif";
overfilter="Fade(duration=0.2);Alpha(opacity=90);Shadow(color='#777777', Direction=135, Strength=5)";
outfilter="randomdissolve(duration=0.3)";
}

<?
	function makedb($row){
		echo "with(milonic=new menuname(\"$row[1]\")){\n";
		echo "style=menuStyle;\n";
		echo "overflow=\"scroll\";\n";			
		$sql2 = "SELECT * FROM menu WHERE menuname = '$row[1]'";
	    $result2 = mysql_query($sql2);				
		while ($row = mysql_fetch_row($result2))  {
			if($row[4] == "" && $row[3] != ""){
				echo "aI(\"text=$row[2];url=$row[3];\");\n";
			} elseif ($row[4]!="" && $row[3] != "") {
				echo "aI(\"text=$row[2];url=$row[3];showmenu=$row[4];\");\n";
			} elseif ($row[4]!="" && $row[3] = "") {
				echo "aI(\"text=$row[2];showmenu=$row[4];\");\n";
			}
		}
		echo "}\n";
	}	
	$dbname = "mainmenu";
	$sql = "SELECT * FROM menu WHERE menuname != 'mainmenu'";
	$result = mysql_query($sql);
	$nrows = mysql_num_rows($result);
	while($row = mysql_fetch_row($result)){	
		if(strstr($dbname,$row[1])){
		}
		else{ 
			makedb($row);
			$dbname.= ",".$row[1];
		}
							
	}
?>
drawMenus();
thats the code i developed my database is set up as
id,menuname,text,url,showmenu
if you want i can export my menu table from my data base for yeah so you can import it to yours for instant table setup[/code]
_shft.void(7)
frenzy
Advanced
Advanced
Posts: 10
Joined: Thu Apr 22, 2004 8:08 pm
Contact:

Post by frenzy »

Andy wrote:A demo of how to build menus in PHP from a database will be coming soon...
Andy.
Hello Andy, just wonder when is soon please ?
User avatar
Ruth
 Team
 Team
Posts: 8763
Joined: Thu May 15, 2003 5:02 am
Location: Yucaipa, CA
Contact:

Post by Ruth »

Try this, not sure if it's what you want or will be helpful.

I think that's asp_mysql, but it may help with what you want.

Ruth
frenzy
Advanced
Advanced
Posts: 10
Joined: Thu Apr 22, 2004 8:08 pm
Contact:

Post by frenzy »

i still have got it, but i'm looking for php dym menu and the link for the php zip seems broken

thanks anyway
User avatar
Andy
Milonic
Milonic
Posts: 3308
Joined: Sun May 19, 2002 8:23 pm
Location: Menu Developer
Contact:

Post by Andy »

Hi,

Does the link http://support.milonic.com/datamenu/ not work?

Cheers,
Andy
frenzy
Advanced
Advanced
Posts: 10
Joined: Thu Apr 22, 2004 8:08 pm
Contact:

Post by frenzy »

oh, it was error 404 2 hours ago lol

sorry, thanks :)
Post Reply