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:53
PHP/MySQL driven menu
Poster: Googolplex
Dated: Tuesday December 2 2003 - 23:25:26 GMT
Does anyone have an example of a PHP/MySQL driven menu ?
Poster: John
Dated: Wednesday December 3 2003 - 2:53:25 GMT
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.
Poster: Googolplex
Dated: Wednesday December 3 2003 - 22:11:17 GMT
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 ?
Poster: Andy
Dated: Thursday December 4 2003 - 8:08:51 GMT
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.
Poster: Googolplex
Dated: Thursday December 4 2003 - 15:28:52 GMT
Sounds great, I will look forward to that
Poster: System7
Dated: Thursday December 4 2003 - 20:14:30 GMT
this might help
this is what is on the page where i have my menu
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";
}
}
$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:
<?
$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();
$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]
Poster: frenzy
Dated: Wednesday March 2 2005 - 16:05:52 GMT
Andy wrote:
A demo of how to build menus in PHP from a database will be coming soon...
Andy.
Andy.
Hello Andy, just wonder when is soon please ?
Poster: Ruth
Dated: Wednesday March 2 2005 - 18:06:50 GMT
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
Poster: frenzy
Dated: Wednesday March 2 2005 - 18:45:23 GMT
i still have got it, but i'm looking for php dym menu and the link for the php zip seems broken
thanks anyway
Poster: Andy
Dated: Wednesday March 2 2005 - 18:53:34 GMT
Hi,
Does the link http://support.milonic.com/datamenu/ not work?
Cheers,
Andy