Milonic provide full featured pull down web menus for some of the worlds largest companies
click here to see what it can do for you

Download Milonic DHTML Menu
Buy Milonic DHTML Menu

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:56

generating the menu_data file using mysql and php


Poster: System7
Dated: Tuesday November 18 2003 - 19:28:23 GMT

ok i hope someone can help

i know this is possible cuz the milonic site does it well i assume they do because in there source you can see menu_data.php as there script source

k so in my main page i have this

Code:
<?
      $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";
            }
         }
   ?>      


k now that works fine
the tables in my database are set up like so
id , menuname , title , url , showmenu

now in my menu_data.php file i have the following

Code:
_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";
overfilter="Fade(duration=0.2);Alpha(opacity=90);Shadow(color='#777777', Direction=135, Strength=5)";
outfilter="randomdissolve(duration=0.3)";
}

<?
   $i=0;
   $sql = "SELECT * FROM menu WHERE menuname != 'mainmenu'";
    $result = mysql_query($sql);
   while ($row = mysql_fetch_row($result))  {
      $name[$i] = $row[1];
      $sql .= " && menuname != '$name[$i]' ";      
      echo "with(milonic=new menuname(\"$row[1]\")){\n";
      echo "style=menuStyle;\n";
      echo "overflow=\"scroll\";\n";
      $sql2 = "SELECT * FROM menu WHERE menuname = '$name[$i]'";
       $result2 = mysql_query($sql2);         
      $i++;   
      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];\");\n";
         } elseif ($row[4]!="" && $row[3] = "") {
            echo "aI(\"text=$row[2];showmenu=$row[4];\");\n";
         }
      }
      echo "}\n";
      
   }
?>
drawMenus();


now this works except theres one problem that i thought the line
Code:
$sql .= " && menuname != '$name[$i]' ";
would solve but it hasnt. the problem is that for ever element under a menu it creates that many menu's heres a sample of what my menu_data.php file looks like if you view teh source after this script as run
Code:
_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";
overfilter="Fade(duration=0.2);Alpha(opacity=90);Shadow(color='#777777', Direction=135, Strength=5)";
outfilter="randomdissolve(duration=0.3)";
}

with(milonic=new menuname("area_office")){
style=menuStyle;
overflow="scroll";
aI("text=CPAC;url=index.php?page=area_office&section=CPAC;");
aI("text=AMT;url=index.php?page=area_office&section=AMT;");
aI("text=AHT;url=index.php?page=area_office&section=AHT;");
}
with(milonic=new menuname("area_office")){
style=menuStyle;
overflow="scroll";
aI("text=CPAC;url=index.php?page=area_office&section=CPAC;");
aI("text=AMT;url=index.php?page=area_office&section=AMT;");
aI("text=AHT;url=index.php?page=area_office&section=AHT;");
}
with(milonic=new menuname("area_office")){
style=menuStyle;
overflow="scroll";
aI("text=CPAC;url=index.php?page=area_office&section=CPAC;");
aI("text=AMT;url=index.php?page=area_office&section=AMT;");
aI("text=AHT;url=index.php?page=area_office&section=AHT;");
}


so you can see it is creating a menu for each item in the menu if anyone can help me fix this it would be a great help right now i cant think of what


Poster: System7
Dated: Friday November 21 2003 - 17:42:01 GMT

nm figured it out


Poster: liyenn
Dated: Thursday December 7 2006 - 4:47:44 GMT

i've been looking for solution on this same matter...
can i know how to make it work please???


Poster: John
Dated: Thursday December 7 2006 - 14:06:40 GMT

There's a demo in /extras/ in the system download. Did you check that?


Poster: liyenn
Dated: Thursday December 7 2006 - 16:29:17 GMT

John wrote:
There's a demo in /extras/ in the system download. Did you check that?


sorry,i'm still not familiar with this website as this is the 1st day i found it..

can you show me where is the system download is?

thank you!


Poster: John
Dated: Thursday December 7 2006 - 16:41:58 GMT

The download page is here.


Poster: liyenn
Dated: Thursday December 7 2006 - 16:43:12 GMT

John wrote:
The download page is here.


thanks for your reply!!!!!!

thanks a lot!

i'll go to check it out now ;)


Poster: liyenn
Dated: Thursday December 7 2006 - 17:00:54 GMT

i'm trying on the php_mysql based menu...
i installed the database and try to run it from localhost, however, why it appeared as below? i thought it suppose to be a menu? did imisunderstand anything?

Code:

Beta files are downloadable from here: mysqlmenu.zip

Here is the database scheme for mini_menu.sql

If you are looking for ASP/SQLServer, here it is: asp_sql_datamenus.zip
#
# Table structure for table `mm_items`
#

CREATE TABLE `mm_items` (
  `itemid` int(11) NOT NULL auto_increment,
  `menuid` int(11) NOT NULL default '0',
  `text` text,
  `url` varchar(255) default NULL,
  `showmenu` varchar(40) default NULL,
  PRIMARY KEY  (`itemid`)
) TYPE=MyISAM AUTO_INCREMENT=50 ;

#
# Dumping data for table `mm_items`
#

INSERT INTO `mm_items` VALUES (1, 1, 'MILONIC', 'http://www.milonic.com', NULL);
INSERT INTO `mm_items` VALUES (2, 1, 'Sample Menus', NULL, 'Menu Samples');
INSERT INTO `mm_items` VALUES (3, 1, 'About Milonic', NULL, 'About Milonic');
INSERT INTO `mm_items` VALUES (4, 1, 'Partners', NULL, 'Partners');
INSERT INTO `mm_items` VALUES (5, 1, 'Links', NULL, 'Links');
INSERT INTO `mm_items` VALUES (6, 2, 'Horizontal Navigational Menu', NULL, NULL);
INSERT INTO `mm_items` VALUES (7, 2, 'Vertical Navigational Menu', '/menusample2.php', NULL);
INSERT INTO `mm_items` VALUES (8, 2, 'All Horizontal Menus', '/menusample25.php', NULL);
INSERT INTO `mm_items` VALUES (9, 2, 'Using the popup function Fixed Position', '/menusample3.php', NULL);
INSERT INTO `mm_items` VALUES (10, 2, 'Using the popup Positioned by Images', 'menusample24.php', NULL);
INSERT INTO `mm_items` VALUES (11, 2, 'Image Map Sample', 'menusample4.php', NULL);
INSERT INTO `mm_items` VALUES (12, 2, 'Multiple Styles', 'menusample5.php', NULL);
INSERT INTO `mm_items` VALUES (13, 2, 'Menus and Tool Tips', 'menusample6.php', NULL);
INSERT INTO `mm_items` VALUES (14, 2, 'Multiple Colored Menus', 'menusample7.php', NULL);
INSERT INTO `mm_items` VALUES (15, 2, 'Menu Items as Headers', 'menusample8.php', NULL);
INSERT INTO `mm_items` VALUES (16, 2, 'Windows XP Style Menus', 'menusample12.php', NULL);
INSERT INTO `mm_items` VALUES (17, 2, 'Windows 98 Style Menus', 'menusample13.php', NULL);
INSERT INTO `mm_items` VALUES (18, 2, 'Relative Positioning (Table Bound)', 'menusample9.php', NULL);
INSERT INTO `mm_items` VALUES (19, 2, 'Follow Scrolling', 'menusample10.php', NULL);
INSERT INTO `mm_items` VALUES (20, 2, 'Opening Windows & Frames', 'menusample11.php', NULL);
INSERT INTO `mm_items` VALUES (21, 2, 'Hiding DIVs when displaying menus', 'menusample14.php', NULL);
INSERT INTO `mm_items` VALUES (22, 2, 'Activating MouseOver & MouseOut Functions', 'menusample15.php', NULL);
INSERT INTO `mm_items` VALUES (23, 2, 'Dynamic Dragable Menus', 'menusample22.php', NULL);
INSERT INTO `mm_items` VALUES (24, 2, 'Positioning with screenposition & offsets', 'menusample23.php', NULL);
INSERT INTO `mm_items` VALUES (25, 2, '100% Width Span Menu', 'menusample26.php', NULL);
INSERT INTO `mm_items` VALUES (26, 2, 'Context Right Click Menu', 'menusample27.php', NULL);
INSERT INTO `mm_items` VALUES (27, 2, 'Static Images Sample', 'menusample16.php', NULL);
INSERT INTO `mm_items` VALUES (28, 2, 'Rollover/swap Images', 'menusample17.php', NULL);
INSERT INTO `mm_items` VALUES (29, 2, 'Menus built from images', 'menusample18.php', NULL);
INSERT INTO `mm_items` VALUES (30, 2, 'Images as Menu Backgrounds', 'menusample19.php', NULL);
INSERT INTO `mm_items` VALUES (31, 2, 'Background Menu Item Images', 'menusample20.php', NULL);
INSERT INTO `mm_items` VALUES (32, 3, 'Product Purchasing Page', 'http://www.milonic.com/cbuy.php', NULL);
INSERT INTO `mm_items` VALUES (33, 3, 'Contact Us', 'http://www.milonic.com/contactus.php', NULL);
INSERT INTO `mm_items` VALUES (34, 3, 'Newsletter Subscription', 'http://www.milonic.com/newsletter.php', NULL);
INSERT INTO `mm_items` VALUES (35, 3, 'FAQ', 'http://www.milonic.com/menufaq.php', NULL);
INSERT INTO `mm_items` VALUES (36, 3, 'Discussion Forum', 'http://www.milonic.com/forum/', NULL);
INSERT INTO `mm_items` VALUES (37, 3, 'Software License Agreement', 'http://www.milonic.com/license.php', NULL);
INSERT INTO `mm_items` VALUES (38, 3, 'Privacy Policy', 'http://www.milonic.com/privacy.php', NULL);
INSERT INTO `mm_items` VALUES (39, 4, '(aq) Web Hosting', 'http://www.a-q.co.uk/', NULL);
INSERT INTO `mm_items` VALUES (40, 4, 'SMS 2 Email', 'http://www.sms2email.com/', NULL);
INSERT INTO `mm_items` VALUES (41, 4, 'WebSmith', 'http://www.websmith.com/', NULL);
INSERT INTO `mm_items` VALUES (42, 5, 'Apache Web Server', 'http://www.apache.org/', NULL);
INSERT INTO `mm_items` VALUES (43, 5, 'MySQL Database Server', 'http://ww.mysql.com/', NULL);
INSERT INTO `mm_items` VALUES (44, 5, 'PHP - Development', 'http://www.php.net/', NULL);
INSERT INTO `mm_items` VALUES (45, 5, 'phpBB Web Forum System', 'http://www.phpbb.net/', NULL);
INSERT INTO `mm_items` VALUES (46, 5, 'Anti Spam Tools', '', 'antispam');
INSERT INTO `mm_items` VALUES (47, 6, 'Spam Cop', 'http://www.spamcop.net/', NULL);
INSERT INTO `mm_items` VALUES (48, 6, 'Mime Defang', 'http://www.mimedefang.org/', NULL);
INSERT INTO `mm_items` VALUES (49, 6, 'Spam Assassin', 'http://www.spamassassin.org/', NULL);

# --------------------------------------------------------

#
# Table structure for table `mm_menus`
#

CREATE TABLE `mm_menus` (
  `menuid` int(11) NOT NULL auto_increment,
  `projectid` int(11) NOT NULL default '0',
  `styleid` int(11) NOT NULL default '0',
  `name` varchar(40) NOT NULL default '',
  `alwaysvisible` tinyint(1) default NULL,
  `orientation` tinyint(1) default NULL,
  `overflow` varchar(20) default NULL,
  PRIMARY KEY  (`menuid`)
) TYPE=MyISAM AUTO_INCREMENT=7 ;

#
# Dumping data for table `mm_menus`
#

INSERT INTO `mm_menus` VALUES (1, 1, 1, 'Main Menu', 1, 1, NULL);
INSERT INTO `mm_menus` VALUES (2, 1, 1, 'Menu Samples', NULL, NULL, 'scroll');
INSERT INTO `mm_menus` VALUES (3, 1, 1, 'About Milonic', NULL, NULL, NULL);
INSERT INTO `mm_menus` VALUES (4, 1, 1, 'Partners', NULL, NULL, NULL);
INSERT INTO `mm_menus` VALUES (5, 1, 1, 'Links', NULL, NULL, NULL);
INSERT INTO `mm_menus` VALUES (6, 1, 1, 'AntiSpam', NULL, NULL, NULL);

# --------------------------------------------------------

#
# Table structure for table `mm_projects`
#

CREATE TABLE `mm_projects` (
  `projectid` int(11) NOT NULL auto_increment,
  `menuCloseDelay` int(11) NOT NULL default '500',
  `menuOpenDelay` int(11) NOT NULL default '150',
  `subOffsetTop` tinyint(1) NOT NULL default '0',
  `subOffsetLeft` tinyint(1) NOT NULL default '0',
  `name` varchar(100) default NULL,
  PRIMARY KEY  (`projectid`)
) TYPE=MyISAM AUTO_INCREMENT=2 ;

#
# Dumping data for table `mm_projects`
#

INSERT INTO `mm_projects` VALUES (1, 500, 150, 2, -3, 'Minimalist Menu');

# --------------------------------------------------------

#
# Table structure for table `mm_styles`
#

CREATE TABLE `mm_styles` (
  `styleid` int(11) NOT NULL auto_increment,
  `name` varchar(40) NOT NULL default '',
  `oncolor` varchar(6) default NULL,
  `onbgcolor` varchar(6) default NULL,
  `offcolor` varchar(6) default NULL,
  `offbgcolor` varchar(6) default NULL,
  `padding` tinyint(4) default NULL,
  `separatorsize` tinyint(4) default NULL,
  `borderwidth` tinyint(4) default NULL,
  `fontfamily` varchar(25) default NULL,
  `fontsize` varchar(6) default NULL,
  PRIMARY KEY  (`styleid`)
) TYPE=MyISAM AUTO_INCREMENT=2 ;

#
# Dumping data for table `mm_styles`
#

INSERT INTO `mm_styles` VALUES (1, 'miniStyle', 'FFFFFF', '4F8EB6', '000000', 'FFFFFF', 3, 1, 1, 'verdana', '10px');
   


Poster: liyenn
Dated: Friday December 8 2006 - 10:06:35 GMT

ok, i got it shown already...

now trying to apply it to my application..

=)

thanks!

I can't see the menu


Poster: rcappuccio
Dated: Sunday February 4 2007 - 18:42:21 GMT

liyenn wrote:
ok, i got it shown already...

now trying to apply it to my application..

=)

thanks!


Hi liyenn how did you do to show the menu...i canĀ“t make it work. I need the info urgently.