Milonic Menu form DB MySQL/PHP

Having problems with DHTML Menu? There is usually somebody here who knows the answer.
Post Reply
lumomm
Beginner
Beginner
Posts: 1
Joined: Thu Oct 09, 2003 3:27 pm

Milonic Menu form DB MySQL/PHP

Post by lumomm »

I have searched this forum for a script to build up the Menu from a DB. I have found some .asp related scripts but no .php, does someone knows where I can find this, or not then I will develop this one. :)
User avatar
John
 Team
 Team
Posts: 5967
Joined: Sun May 19, 2002 8:23 pm
Location: Phoenix, AZ
Contact:

Post by John »

Yes, it is possible (which is why I moved your post). I'm not a .php person, but I'm sure a lot of folks will jump in and help you with this.
John
User avatar
Maz
Milonic God
Milonic God
Posts: 1717
Joined: Fri Jun 06, 2003 11:39 pm
Location: San Francisco
Contact:

Post by Maz »

Your search probably produced hints, but nothing complete, I would appreciate anything you can produce on php & mysql :D

Thank you!
maz
User avatar
John
 Team
 Team
Posts: 5967
Joined: Sun May 19, 2002 8:23 pm
Location: Phoenix, AZ
Contact:

Post by John »

Hints, yes, but nothing complete. I know folks have done it (I've got ColdFusion driving one of mine), and they'll be around.
John
User avatar
Andy
Milonic
Milonic
Posts: 3308
Joined: Sun May 19, 2002 8:23 pm
Location: Menu Developer
Contact:

Post by Andy »

This is on the to-do list but as it seems to get bigger rather than smaller could be a while off.

You are more than welcome to build one but I don't see the point in having lots of these floating around. One definitive script should do all.

How's your knowledge of PHP Classes?

-- Andy
User avatar
bonewalker
Super Advanced
Super Advanced
Posts: 40
Joined: Tue Aug 19, 2003 10:35 pm

Post by bonewalker »

I have done a very large menu (over 1700 items) using PHP. It isn't difficult really.

All you need to do is create a MySQL query that returns your data, then output it via php in the correct format for the menu to use. Then instead of menu_data.js, point your script to menu_data.php.

All goes smoothly for me.

Here is a code snippet: (be aware I am not a programmer, so I don't know anything about classes) :)

Code: Select all

$sql="select * from $table where name like '$letter%' order by name";
$menu_data.="with(milonic=new menuname(\"s$letter\")){\r\n itemwidth=300;\r\n borderwidth=1;\r\n style=style1;\r\n alignment='left';\r\n top=150;\r\n overflow='scroll';\n";

$result = db_query($sql); 

	while ($record = get_record($result))
	{
	$name=$record[name];
	$ext=$record[ext];
	$roomapt=$record[roomapt];
	$city=$record[city];
	$state=$record[state];
	$zip=$record[zip];
	$homephone=$record[homephone];
	$email=$record[email];
		$menu_data.= "aI('text=<font size=2><b>$name - $ext</b></font><br>$roomapt<br>Home - $homeaddy, $city $state $zip<br>$homephone<br>$email;separatorsize=1;align=left')\n";
	}
	$menu_data.="\n } \n";

                echo $menu_data;
Hope that helps.

Bonewalker
Post Reply