Recent Questions Tree Menu Tutorial
Q: I’d like to know how to populate the navigation bar menu from a database?
A: Please, see the example of .php file.The content of .php file depends on your database structure.
<?php
// The example for PHP/MySQL.
// MySQL database has the table "menuTable" that contains data for menu 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 = [
// Write Javascript code for menu items
echo getMenuItems();
?>
];
</script>
Q: I am using your Deluxe Tabs software, and I am simply trying to implement your dhtml menu samples:
http://deluxe-tabs.com/file/templates/deluxe-tabs-style-3.html
I have downloaded the trial software and built my tabs, but at this point, all I have is the tabs... I need the entire box under the tabs, and I need to be able to insert my content for each tab.
Please explain to me how to use your dhtml menu samples.
A: You should specify any Object ID name of the DIV.
See, for each item you should assign the ID property of the contentDIV (see data file with your menu parameters).
["Style Name","contentName", "", "", "", "", "1", "", "", ],
["-","", "", "", "", "", "0", "", "", ],
["Style Description","contentDescription", "", "", "", "", "", "", "", ],
["-","", "", "", "", "", "0", "", "", ],
["Style Variations","contentVariations", "", "", "", "", "", "", "", ],
["-","", "", "", "", "", "0", "", "", ],
["Empty","", "", "", "", "", "2", "", "", ],
And on your html page you should create DIV's with such ID. You canset background image for these DIV's in styles.
<div id="contentName" style="height: 0%; visibility: hidden; background-image: url('img/back.jpg'); background-repeat:repeat-y;" class="tabPage">
<br><br><br>
<p align=center><img src="img/style01_title.gif" width=140 height=90 alt="Glass Style Tabs"></p>
<br><br><br>
You should paste your content here!!!!!
</div>
<div id="contentDescription" style="height: 0%; visibility: hidden;" class="tabPage">
<br><br><br>
<p align=center><img src="img/style01_title.gif" width=140 height=90 alt="Glass Style Tabs"></p>
<br><br><br>
You should paste your description here!!!!!
</div>
Q: I would like to know how to put items in on multiple lines for the horizontal navigation
(i.e. create a line feed), how do I tell my code to start a new menuitem on the NEXT line?
A: There are 2 ways to do that:
1) set
var noWrap=0;
2) use <br> tags, for example:
var menuItems = [
["|Here is where <br>I would like <br>to have a line<br> feed",,"","", "", "", "", "", "", "", "",],
];
Q: Does the Deluxe menu work to load pages into an iframe?
(name=iframe1) I can't find any info on this ...
A: Of course. Please, use this parameter:
var itemTarget = "frame_name";