Back To Start Of Archive
Taken From The Forum: Help & Support for DHTML Menu Version 5+
Forum Topic: Click to view post
Last Updated: Saturday July 14 2012 - 06:07:05
Milonic Menu form DB MySQL/PHP
Poster: lumomm
Dated: Thursday October 9 2003 - 15:39:27 BST
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.
Poster: John
Dated: Thursday October 9 2003 - 15:47:34 BST
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.
Poster: Maz
Dated: Thursday October 9 2003 - 15:49:04 BST
Your search probably produced hints, but nothing complete, I would appreciate anything you can produce on php & mysql
Thank you!
maz
Poster: John
Dated: Thursday October 9 2003 - 15:54:43 BST
Hints, yes, but nothing complete. I know folks have done it (I've got ColdFusion driving one of mine), and they'll be around.
Poster: Andy
Dated: Thursday October 9 2003 - 18:33:18 BST
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
Poster: bonewalker
Dated: Thursday October 9 2003 - 22:04:27 BST
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:
$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;
$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