|
Do you have a working sample of the dhtml menu download with PHP/MySQL?
Return to Recent Questions
Q:
I want to create the dhtml menu download on my website using PHP/MySQL. I have found some info on
it in your Support section, but have problems to understand and
wonder if you have additional info or a working sample of the dhtml menu download with PHP / MySQL.
A:
Info about generating dhtml menu download (menu items )from a database, please, see:
http://dhtml-menu.com/menu/generate-menu-from-database-xml-php-asp-vb-support.html
The content of .php file depends on your database structure.
See the example of .php file:
<?php
// The example for PHP/MySQL.
// MySQL database has the table "menuTable" that contains data for dhtml menu download items.
// The table has the following fields:
// 1. "text" - item text
// 2. "link" - item link
// 3. "icon1" - item icon (normal state)
// 4. "icon2" - item icon (mouseover state)
function getMenuItems()
{
$jsItems = '';
// Select all records from table "menuTable"
$allItems = mysql_query('SELECT * FROM menuTable;');
// Extract items data from database and build Javascript code for menuItems
while ($itemData=mysql_fetch_array($allItems))
{
$jsItems .= '["'.$itemData['text'].'", "'.$itemData['link'].'", "'.$itemData['icon1'].'", "'.$itemData['icon2'].'"],';
}
// Return Javascript code
return $jsItems;
}
?>
<script>
var menuParam1 = value1;
var menuParam2 = value2;
var menuParam2 = value2;
...
var menuItems = [
<?php
// Write Javascript code for menu items
echo getMenuItems();
?>
];
</script>
Return to Recent Questions
Related:
- Apr 25, 2007 - How to work with script java menu and submenus in JSP?
- Apr 26, 2007 - My mouse over menu don't work with a popup...
- May 09, 2007 - I am unable to see any separators when working with html menu...
- May 29, 2007 - Will this script menue work for us, as we use IFrames and Frameset?
- May 30, 2007 - Can you create/destroy menu in dhtml javascript with only client side javascript?
- Jun 21, 2007 - list css menu doesn't work with Internet Explorer.
- Jun 25, 2007 - Your css list menu doesn't work on Mac with Safari.
- Jul 26, 2007 - The autoscroll function doesn't work with the css positioning though in drop down menus html onMouseOver.
- Aug 01, 2007 - The copy/paste and the CTRL + C/V & Insert keys don't seem to work in down menu dhtml.
- Aug 28, 2007 - Can this html dropdown menu work with tables?
- Sep 20, 2007 - Does dynamic menu bar works with JSP? How can I do that?
|