How do I add extra style options in MySQL
-
- Advanced
- Posts: 13
- Joined: Wed Jun 15, 2005 1:06 pm
- Contact:
How do I add extra style options in MySQL
Hello,
I'm trying out this menu. And I like the PHP with MySQL part alot.
I got it running so far but still has a few problems.
I have no real knowledge of PHP or SQL. I can "read" it and find the things I need to change and that's it.
I would like to use a different style sheet for the main menu then for the drop downs. I tried with adding a extra style in the database (with the number 2) and linked it to the drop down menus. But it doesn't seem to work. How do I do this?
Once I see that this menu can do what I want it to do I'll be sure to buy a license .
Please help me. Thank you very much
I'm trying out this menu. And I like the PHP with MySQL part alot.
I got it running so far but still has a few problems.
I have no real knowledge of PHP or SQL. I can "read" it and find the things I need to change and that's it.
I would like to use a different style sheet for the main menu then for the drop downs. I tried with adding a extra style in the database (with the number 2) and linked it to the drop down menus. But it doesn't seem to work. How do I do this?
Once I see that this menu can do what I want it to do I'll be sure to buy a license .
Please help me. Thank you very much
-
- Advanced
- Posts: 13
- Joined: Wed Jun 15, 2005 1:06 pm
- Contact:
I forgot to add the link to my site if needed .
Please remember this menu doesn't look yet like it should. I'm still testing the style options
http://www.aangepasteauto.nl/restyle/te ... itemap.php
Please remember this menu doesn't look yet like it should. I'm still testing the style options
http://www.aangepasteauto.nl/restyle/te ... itemap.php
Why put it in the DB? Just add a new style in with the two other syyles you already have in your _data file. Even better, since you're calling miniStyle for your main menu just edit that one to the new look you want. The two styles you now have coded are almost exactly the same, which, of course, results in the same look in your menu system.
John
-
- Advanced
- Posts: 13
- Joined: Wed Jun 15, 2005 1:06 pm
- Contact:
Thank you for the fast reply!
The styles are loaded from the DB. These is no _data.js file that is used.
All the files that are used are:
In the DB in "mm_styles" you enter the styles with a unique number for that style. For every drop down menu you have entered in "mm_menus" you set the style number.
All this generates the 2 style sheets you see.
It just doesn't add the right style to the right menu part. It keeps using the main sheet.
UPDATE: As far as I can see is the menu and the sheets made in "mm_phpmenu.php". But I don't know what to change there if needed to make more then one style sheet work. Does anyone know what to do?
The styles look almost the same . But on the main menu (miniStyle) I want to remove the border, shadow, etc... but it's still there so I can see it works . So in the end it will be different.
Hope this info helps.
The styles are loaded from the DB. These is no _data.js file that is used.
All the files that are used are:
Code: Select all
mm_config.php
mm_phpmenu.php
milonic_src.js
mmenudom.js
mmenuns4.js
All this generates the 2 style sheets you see.
It just doesn't add the right style to the right menu part. It keeps using the main sheet.
UPDATE: As far as I can see is the menu and the sheets made in "mm_phpmenu.php". But I don't know what to change there if needed to make more then one style sheet work. Does anyone know what to do?
The styles look almost the same . But on the main menu (miniStyle) I want to remove the border, shadow, etc... but it's still there so I can see it works . So in the end it will be different.
Hope this info helps.
-
- Advanced
- Posts: 13
- Joined: Wed Jun 15, 2005 1:06 pm
- Contact:
I've read on the forum that http://www.Milonic.com uses the PHP MySQL version too. And they use different sheets for the main menu and the drop downs. So I know it can be done.
Has really nobody here done it? Or can nobody help me do it?
Has really nobody here done it? Or can nobody help me do it?
Hi,
Php and mysql are kind of out of my knowledge area, however..... As I understand what Milonic does, it names the menu_data.js file as menu_data.php that way it gets parsed. I know the Milonic menu_data.php file has different styles in it. Since I don't know anything about php, maybe something else is being done to get that menu_data.php file, but I've only ever seen posts saying to rename the menu_data.js to menu_data.php [or cfm etc.]
Ruth
Php and mysql are kind of out of my knowledge area, however..... As I understand what Milonic does, it names the menu_data.js file as menu_data.php that way it gets parsed. I know the Milonic menu_data.php file has different styles in it. Since I don't know anything about php, maybe something else is being done to get that menu_data.php file, but I've only ever seen posts saying to rename the menu_data.js to menu_data.php [or cfm etc.]
Ruth
-
- Advanced
- Posts: 13
- Joined: Wed Jun 15, 2005 1:06 pm
- Contact:
I know nothing about programming... but...
My guess would be that mm_phpmenu.php gets the menu from the DB?
That file has the following code.
I take it...
Makes the style(s). Don't know if it just looks for 1 or more styles?
The "createMenuStyle" gave it kinda away .
I hope this helps.
My guess would be that mm_phpmenu.php gets the menu from the DB?
That file has the following code.
Code: Select all
<?php
if (!mysql_pconnect($dbHost,$dbUser,$dbPasswd))
{
die("Couldn't connect to the database server $MySQLServer<br><br>");
}
else
{
mysql_select_db($dbName);
}
function runquery($query)
{
global $adminEmail,$sendErrorReports;
if (!($qry = mysql_query($query)))
{
$hostname=gethostbyaddr($_SERVER[REMOTE_ADDR]);
echo "<br> MySQL Error - " . mysql_errno() . ": " . mysql_error() . "<br>";
$mailbody = "
IP Addr: $_SERVER[REMOTE_ADDR]
Browser: $_SERVER[HTTP_USER_AGENT]
Page: $_SERVER[SCRIPT_FILENAME]?$_SERVER[QUERY_STRING]
Date: " . date("D F j, Y, G:i:s") . "
Host: $hostname
Server: $_SERVER[HTTP_HOST]
Referer: $_SERVER[HTTP_REFERER]
MySQL Error - " . mysql_errno() . ": " . mysql_error() ."
\n\n
----------------------------------------
Query: $query
----------------------------------------";
$headers = "From: datamenu1@milonic.com";
$subject = "Milonic Data Menu Error";
if($sendErrorReports)mail($adminEmail, $subject, $mailbody, $headers);
}
return $qry;
}
function doquery($query)
{
global $adminEmail,$sendErrorReports;
if (!($qry = mysql_query($query)))
{
$hostname=gethostbyaddr($_SERVER['REMOTE_ADDR']);
echo "<br> MySQL Error - " . mysql_errno() . ": " . mysql_error() . "<br>";
$mailbody = "
IP Addr: $_SERVER[REMOTE_ADDR]
Browser: $_SERVER[HTTP_USER_AGENT]
Page: $_SERVER[SCRIPT_FILENAME]?$_SERVER[QUERY_STRING]
Date: " . date("D F j, Y, G:i:s") . "
Host: $hostname
Server: $_SERVER[HTTP_HOST]
Referer: $_SERVER[HTTP_REFERER]
MySQL Error - " . mysql_errno() . ": " . mysql_error() ."
\n\n
----------------------------------------
Query: $query
----------------------------------------";
$headers = "From: datamenu1@milonic.com";
$subject = "Milonic Data Menu Error";
if($sendErrorReports)mail($adminEmail, $subject, $mailbody, $headers);
}
else
{
if (!ereg("^update", $query)) return mysql_fetch_array($qry);
}
}
function buildMySQLMenu($menuProjectID)
{
global $table_prefix, $menuVars;
// Properties
$query="select * from ".$table_prefix."projects where projectid = $menuProjectID";
$ar=doquery($query);
if(!$ar)die("Could not find menu project");
$menuVars['menuCloseDelay']=$ar['menuCloseDelay'];
$menuVars['menuOpenDelay']=$ar['menuOpenDelay'];
$menuVars['subOffsetTop']=$ar['subOffsetTop'];
$menuVars['subOffsetLeft']=$ar['subOffsetLeft'];
$query="select distinct(styleid) from ".$table_prefix."menus where projectid = $menuProjectID";
$sqry=runquery($query);
$styles=array();
while ($sar = mysql_fetch_array($sqry))
{
$query="select * from ".$table_prefix."styles where styleid=$sar[styleid]";
$ar=doquery($query);
$mmStyle=new mmenuStyle();
$sysCtr=0;
foreach ($ar as $k => $v)
{
if($sysCtr==1)$sysCtr=0; else $sysCtr=1;
if($sysCtr==0)
{
if($k!="styleid" && $k!="name")
$mmStyle->$k=$v;
}
}
$mmStyle->createMenuStyle($ar['name']);
$styles[$sar['styleid']]=$ar['name'];
}
$query="select * from ".$table_prefix."menus where projectid = $menuProjectID";
$mqry=runquery($query);
while ($mar = mysql_fetch_array($mqry))
{
$sysCtr=0;
$mmMenu=new mMenu();
foreach ($mar as $k => $v)
{
if($sysCtr==1)$sysCtr=0; else $sysCtr=1;
if($sysCtr==0)
{
if(($k!="menuid" && $k!="projectid" && $k!="name") && $v)
{
if($k=="styleid")
{
$k="style";
$v=$styles[1];
}
$mmMenu->$k=$v;
}
}
}
$sysCtr=0;
$query="select * from ".$table_prefix."items where menuid=$mar[menuid]";
$iqry=runquery($query);
while ($iar = mysql_fetch_array($iqry))
{
$mmItem = new mItem();
$andy=0;
foreach ($iar as $k => $v)
{
if($sysCtr==1)$sysCtr=0; else $sysCtr=1;
if($sysCtr==0)
{
if(($k!="menuid" && $k!="itemid") && $v)
{
$mmItem->addItemElement($k, $v);
}
}
}
$mmMenu->addItemFromItem($mmItem);
}
$mmMenu->createMenu($mar['name']);
}
commitMenus();
}
$menuData="";
class mmenuStyle
{
function createMenuStyle($styleName)
{
global $menuData;
$styleArray=get_object_vars($this);
$menuData.="with($styleName=new mm_style()){\n";
foreach ($styleArray as $k => $v)
{
if(ereg("color",$k))
{
if(substr($v,0,1)!="#")$v="#".$v;
}
$menuData.= "$k=\"$v\";\n";
}
$menuData.= "}\n\n";
}
}
class mMenu
{
var $menuItems;
function createMenu($menuName)
{
global $menuData;
$menuArray=get_object_vars($this);
$menuData.= "with(milonic=new menuname(\"$menuName\")){\n";
$tempMenuItems="";
foreach ($menuArray as $k => $v)
{
global $menuData;
if($k!="menuItems")
{
if($k=="style")
{
$menuData.= "$k=$v;\n";
}
else
{
$menuData.= "$k=\"$v\";\n";
}
}
else
{
if($k=="menuItems")$tempMenuItems=$v;
}
}
$menuData.= $tempMenuItems."\n";
$menuData.= "}\n\n";
}
function addItemFromText($itemText)
{
global $menuData;
$this->menuItems.="aI(\"".$itemText . "\");\n";
}
function addItemFromItem($menuItem)
{
global $menuData;
$tempVar="";
foreach ($menuItem as $k => $v)
{
if(ereg("color",$k))
{
if(substr($v,0,1)!="#")$v="#".$v;
}
$tempVar.="$k=$v;";
}
$this->menuItems.="aI(\"".$tempVar . "\");\n";
}
}
class mItem
{
function addItemElement($mtype,$mval)
{
$this->$mtype=$mval;
}
}
function commitMenus()
{
global $menuData,$menuVars;
echo "
<SCRIPT language=\"JavaScript\" src=\"$menuVars[pathToCodeFiles]$menuVars[file_milonicsrc]\" type=\"text/javascript\"></SCRIPT>
<script language=\"JavaScript\">
if(ns4)_d.write(\"<scr\"+\"ipt language=JavaScript src=$menuVars[pathToCodeFiles]$menuVars[file_mmenuns4]><\/scr\"+\"ipt>\");
else _d.write(\"<scr\"+\"ipt language=JavaScript src=$menuVars[pathToCodeFiles]$menuVars[file_mmenudom]><\/scr\"+\"ipt>\");
</script>
";
flush();
echo "<script>\n
_menuCloseDelay=$menuVars[menuCloseDelay];
_menuOpenDelay=$menuVars[menuOpenDelay];
_subOffsetTop=$menuVars[subOffsetTop];
_subOffsetLeft=$menuVars[subOffsetLeft]
$menuData";
echo "drawMenus();\n";
echo "</script>\n";
}
?>
I take it...
Code: Select all
$menuData="";
class mmenuStyle
{
function createMenuStyle($styleName)
{
global $menuData;
$styleArray=get_object_vars($this);
$menuData.="with($styleName=new mm_style()){\n";
foreach ($styleArray as $k => $v)
{
if(ereg("color",$k))
{
if(substr($v,0,1)!="#")$v="#".$v;
}
$menuData.= "$k=\"$v\";\n";
}
$menuData.= "}\n\n";
}
}
The "createMenuStyle" gave it kinda away .
I hope this helps.
-
- Advanced
- Posts: 13
- Joined: Wed Jun 15, 2005 1:06 pm
- Contact:
As far as I can see I did this. I made a dump of the mm_menus and mm_styles part of the DB.Andy wrote:If I remember, all you need to do is create the styles in the styles table then reference them from the menu table.
I hope that helps.
Code: Select all
-- phpMyAdmin SQL Dump
-- version 2.6.0-pl3
-- http://www.phpmyadmin.net
--
-- Host:
-- Generatie Tijd: 28 Jun 2005 om 10:31
-- Server versie: 4.1.8
-- PHP Versie: 5.0.4
--
-- Database: ` `
--
-- --------------------------------------------------------
--
-- Tabel structuur voor tabel `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`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=8 ;
--
-- Gegevens worden uitgevoerd voor tabel `mm_menus`
--
INSERT INTO `mm_menus` VALUES (1, 1, 1, 'Main Menu', 1, 1, NULL);
INSERT INTO `mm_menus` VALUES (2, 1, 2, 'Kopen Verkopen', NULL, NULL, NULL);
INSERT INTO `mm_menus` VALUES (3, 1, 2, 'Informatie voor bedrijven', NULL, NULL, NULL);
INSERT INTO `mm_menus` VALUES (4, 1, 2, 'Algemene voorwaarden', NULL, NULL, NULL);
INSERT INTO `mm_menus` VALUES (5, 1, 2, 'Links', NULL, NULL, NULL);
INSERT INTO `mm_menus` VALUES (6, 1, 2, 'Contact', NULL, NULL, NULL);
-- --------------------------------------------------------
--
-- Tabel structuur voor tabel `mm_styles`
--
CREATE TABLE `mm_styles` (
`styleid` int(11) NOT NULL auto_increment,
`image` varchar(255) default NULL,
`overimage` varchar(255) default NULL,
`imagealign` varchar(6) default NULL,
`name` varchar(40) NOT NULL default '',
`overfilter` varchar(100) default NULL,
`outfilter` varchar(100) default NULL,
`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,
`separatorcolor` varchar(6) NOT NULL default '',
`separatorsize` tinyint(4) default NULL,
`separatorpadding` tinyint(4) default NULL,
`borderwidth` tinyint(4) default NULL,
`fontfamily` varchar(50) default NULL,
`fontsize` varchar(8) default NULL,
`fontweight` varchar(6) NOT NULL default '',
`ondecoration` varchar(12) NOT NULL default '',
`pagecolor` varchar(6) default NULL,
`pageimage` varchar(255) default NULL,
PRIMARY KEY (`styleid`),
FULLTEXT KEY `fontweight` (`fontweight`),
FULLTEXT KEY `separatorcolor` (`separatorcolor`),
FULLTEXT KEY `ondecoration` (`ondecoration`),
FULLTEXT KEY `overfilter` (`overfilter`),
FULLTEXT KEY `outfilter` (`outfilter`),
FULLTEXT KEY `subimageposition` (`imagealign`),
FULLTEXT KEY `onsubimage` (`overimage`),
FULLTEXT KEY `pagecolor` (`pagecolor`),
FULLTEXT KEY `pageimage` (`pageimage`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=36 ;
--
-- Gegevens worden uitgevoerd voor tabel `mm_styles`
--
INSERT INTO `mm_styles` VALUES (1, './block_off.gif', './block_on.gif', 'left', 'miniStyle', NULL, NULL, '000000', 'FFFFFF', '999999', 'FFFFFF', 1, '000000', 1, 5, NULL, 'Verdana, Arial, Helvetica, sans-serif', 'x-small', 'bold', 'underline', '000000', './block_on.gif');
INSERT INTO `mm_styles` VALUES (2, './block_off.gif', './block_on.gif', 'left', 'link', 'Fade(duration=0.3);Shadow(color=''#BBBBBB'',Direction=135,Strength=3)', 'Fade(duration=0.3);Shadow(color=''#BBBBBB'',Direction=135,Strength=3)', '000000', 'FFFFFF', '999999', 'FFFFFF', 1, '000000', 1, 0, 1, 'Verdana, Arial, Helvetica, sans-serif', 'xx-small', 'bold', 'underline', '000000', './block_on.gif');
In mm_menus I gave the main menu styleid 1 and the other (drop down) menus styleid 2.
-
- Super Advanced
- Posts: 72
- Joined: Fri Jul 01, 2005 3:04 pm
-
- Super Advanced
- Posts: 72
- Joined: Fri Jul 01, 2005 3:04 pm
OK! I have been playing and this seems to fix the issue - however was sorted by more luck than judgement, so anyone with more knowledge please jump in.
In mm_phpmenu.php
Look for:
Change to:
Worked for me - but haven't fully tested it yet. Will post back if I realise I have made a fool of myself and posted a 'duff' fix
In mm_phpmenu.php
Look for:
Code: Select all
if($k=="styleid")
{
$k="style";
$v=$styles[1];
}
Code: Select all
if($k=="styleid")
{
$k="style";
$v=$styles[$mar[styleid]];
}
-
- Super Advanced
- Posts: 72
- Joined: Fri Jul 01, 2005 3:04 pm
Ah! Just found another issue. If you are not using a colour in the following references in mm_items in your MySQL db:
oncolor
onbgcolor
offcolor
offbgcolor
then IE6 (PC) causes java script error (OK in MAC firefox). This is caused by mm_phpmenu.php inserting a '#' automatically but not checking if there is actually something in the field first.
My 'workaround' is:
In mm_phpmenu.php find:
Change to:
Again I am not that clued up on PHP or MySQL but the fix work for me
oncolor
onbgcolor
offcolor
offbgcolor
then IE6 (PC) causes java script error (OK in MAC firefox). This is caused by mm_phpmenu.php inserting a '#' automatically but not checking if there is actually something in the field first.
My 'workaround' is:
In mm_phpmenu.php find:
Code: Select all
foreach ($styleArray as $k => $v)
{
if(ereg("color",$k))
{
if(substr($v,0,1)!="#")$v="#".$v;
}
$menuData.= "$k=\"$v\";\n";
}
Code: Select all
foreach ($styleArray as $k => $v)
{
if($v != ''){
if(ereg("color",$k))
{
if(substr($v,0,1)!="#")$v="#".$v;
}
}
$menuData.= "$k=\"$v\";\n";
}
-
- Super Advanced
- Posts: 72
- Joined: Fri Jul 01, 2005 3:04 pm
Wow! Nice to know I wasn't too far off
Where is the updated code?
http://support.milonic.com/datamenu/ ?
Where is the updated code?
http://support.milonic.com/datamenu/ ?
Hi,
I'm not sure if they are up there yet, though probably since Andy is really good on that, but they should be in the new version, which Andy hopes to get out today sometime [5.728] There is a pre-release of that version under the menu version info section, but again, I don't know if the new stuff is in it yet.
I don't know much today
Ruth
I'm not sure if they are up there yet, though probably since Andy is really good on that, but they should be in the new version, which Andy hopes to get out today sometime [5.728] There is a pre-release of that version under the menu version info section, but again, I don't know if the new stuff is in it yet.
I don't know much today
Ruth
-
- Advanced
- Posts: 13
- Joined: Wed Jun 15, 2005 1:06 pm
- Contact:
Should now be posted up to the main download and to http://support.milonic.com/datamenu/
Cheers,
Andy
Cheers,
Andy
-
- Advanced
- Posts: 13
- Joined: Wed Jun 15, 2005 1:06 pm
- Contact:
-
- Super Advanced
- Posts: 72
- Joined: Fri Jul 01, 2005 3:04 pm
-
- Advanced
- Posts: 13
- Joined: Wed Jun 15, 2005 1:06 pm
- Contact: