Location: PHPKode > scripts > Expandable Menu > expandable-menu/menu_data.php
<?php
/*
This file is for setting up the menu entry items and sub-menu entry items, as well as setting a few basic properties of the menu object.  it is possible for this class to connect to a database to obtain menu/sub menu elements.  the class extends a very basic database wrapper which is included and should be placed with the expand-menu class file.
*/
$mnu = new AdvExpMenu();
// set access variables for connecting to a mysql database server
// $ObjectName->DbSetVars('MySQL/Database/Host/Address','DatabaseName','DatabaseUserName','DatabaseUserPassword');
$mnu->DbSetVars('localhost','dbname','dbuser','dbpassword');
// set the menu items
// $ObjectName->AddMainMenuItem('MenuItemName','Menu Text','Menu Type','hrefLocation','Hover Text','MenuIdNumber','SubMenuVisability')
// Menu Types are 'std' & 'sub'
// Sub Menu Visability Types are 'none' & 'show'
// If the menu element has a sub menu, set the Menu Type to 'sub' and the hrefLocation to 'void'
// & the SubMenuVisability to 'show' or 'none', if omitted this defaults to 'show', also some browsers
// can't handle the javascript required to open/close sub menus, the class checks browser and alters
// the parameter to 'show'
$mnu->AddMainMenuItem('Home','Home','std','./index.php','Expand Menu Home Page','1');
$mnu->AddMainMenuItem('Services','Customer Services','sub','void','Customer Services','2','none');
$mnu->AddMainMenuItem('Products','Products','std','void','Products','3');
$mnu->AddMainMenuItem('Contact','Contact Us','std','./contents.php?page=contact','Contact Us','4');
$mnu->AddMainMenuItem('GuestBook','Guestbook','sub','void','Guestbook','5');
$mnu->AddMainMenuItem('About','About Us','std','./contents.php?page=about','About Us','6');
$mnu->AddSubMenuItem('view_gb','View Guestbook','./visitors.php?Action=view&Page=1','View Guestbook','GuestBook','51');
$mnu->AddSubMenuItem('sign_gb','Sign Guestbook','./visitors.php?Action=add&Display=form','Sign Guestbook','GuestBook','52');
// set sub menu items
// $ObjectName->AddSubMenuItem('MenuItemName','Menu Text','hrefLocation','Hover Text','ParentMenuItemName','MenuIdNumber');
$mnu->AddSubMenuItem('cust_devlivery','Delivery','./contents.php?page=custdevlivery','Customer Services: Delivery','Services','21');
$mnu->AddSubMenuItem('cust_warranty','Warranty','./contents.php?page=custwarranty','Customer Services: Warranty','Services','22');
$mnu->AddSubMenuItem('cust_security','Security','./contents.php?page=custsecurity','Customer Services: Security','Services','23');
/*
to get elements for a sub menu from a database table, use
$ReturnVariableName = $ObjectName->GetMenuList('DatabaseTableName','DatabaseFieldName');
this returns all the entries in the table from the specified field and returns an array

$dbMenuItems = $mnu->GetMenuList('dbTableName','dbFieldName');
$xi = 30;
foreach($dbMenuItems as $itm) {
	$xi++;
	$mnu->AddSubMenuItem('Prods_'. $itm,$itm,'./products/index.php?PageNum=1&Catagory='. $itm .'&SortBy=None', $itm, 'ParentMenuName', $xi);
}
*/
?>
Return current item: Expandable Menu