ok i took the general page_menu() function and created a power_menu() function.
the general purporse of this function is to not use the lu and li tages associated with menu's. I loth this way of creating a menu. I favor a css feature that lets you controll the direction of a series of links. the "display: block;" This allows a series of links to be displayed vertically instead of the normal horizontal. so if you have 4 links written normall in html you would get this...
link link link link
now add the css command and it gets transforemd to this
link
link
link
link
ok so that i don't loose your attention here is a template that i am currently working on..
http://uptowninc.us/pages/test/pages2/test-sub3.phpif you did a view source you would notice the menu looks like this
<a href="http://uptowninc.us" target="_top" class="main-menu"><div class="main-menu-div">test</div></a>
<a href="http://uptowninc.us/pages/test/pages2.php" target="_top" class="main-menu-sub"><div class="main-menu-sub-div">pages2</div></a>
<a href="http://uptowninc.us/pages/test/pages2/test-sub3.php" target="_top" class="main-menu-sub-sub-current"><div class="main-menu-sub-sub-div">test sub3</div></a>
<a href="http://uptowninc.us/pages/test/sub-page2.php" target="_top" class="main-menu-sub"><div class="main-menu-sub-div">sub page2</div></a>
<a href="http://uptowninc.us/pages/page2.php" target="_top" class="main-menu"><div class="main-menu-div">page2</div></a>
Css code as folows
.main-menu-current, .main-menu {
background-image: url(Left-nav-button.gif);
height: 28px;
display: block;
font: normal normal bold 16px sans-serif;
color: #283372;
text-decoration: none;
margin: 7px 5px 0px 11px;
}
.main-menu-current, .main-menu:hover {
color: #8A2524;
}
.main-menu-div {
padding: 5px 0px 0px 35px;
}
.main-menu-sub, .main-menu-sub-current {
background-color: #FED78A;
display: block;
margin: 0px 0px 0px 33px;
border-left: 1px solid #C68B37;
border-bottom: 1px solid #C68B37;
border-right: 1px solid #C68B37;
width: 153px;
color: #283372;
font: normal normal normal 14px/normal Arial, sans-serif;
text-decoration: none;
}
.main-menu-sub-current {
color: #8A2524;
}
.main-menu-sub:hover {
color: #8A2524;
text-decoration: underline;
}
.main-menu-sub-div {
padding: 1px 2px 2px 7px;
}
.main-menu-sub-sub, .main-menu-sub-sub-current {
background-color: #FDE4B2;
display: block;
margin: 0px 0px 0px 33px;
border-left: 1px solid #C68B37;
border-bottom: 1px solid #C68B37;
border-right: 1px solid #C68B37;
width: 153px;
color: #283372;
font: normal normal normal 14px/normal Arial, sans-serif;
text-decoration: none;
}
.main-menu-sub-sub-current {
color: #8A2524;
}
.main-menu-sub-sub:hover {
color: #8A2524;
text-decoration: underline;
}
.main-menu-sub-sub-div {
padding: 1px 2px 2px 18px;
}
ok basically the function plugs out every css option explicityly. and each sub level gets output as such (1st sub level) .main-menu-sub, (2nd) .main-menu-sub-sub, and so on and so forth.
if you notice the nested div main-menu-div. this is to proviade cross borswer compabliity in adjusting the text spacing (top, right, bottom, left).
the css may look confusing because there is so much but in realiaty it's pretty basic.. just note the
display: block;
this element is extremly critical
the function i used was as follows
function power_menu($parent = 0, $menu_number = 1, $menu_header = '', $menu_footer = '', $class = 'main-menu', $recurse = LEVEL) {
global $database, $admin, $page_id, $page_trail, $default_link, $extra_sql, $extra_where_sql;
// Check if we should add menu number check to query
if($parent == 0) {
$menu_number = "menu = '$menu_number'";
} else {
$menu_number = '1';
}
// Query pages
$query_menu = $database->query("SELECT page_id,menu_title,page_title,link,target,level,visibility$extra_sql FROM ".TABLE_PREFIX."pages WHERE parent = '$parent' AND $menu_number AND $extra_where_sql ORDER BY position ASC");
// Check if there are any pages to show
if($query_menu->numRows() > 0) {
// Print menu header
echo $menu_header;
// Loop through pages
while($page = $query_menu->fetchRow()) {
// Work-out class
if($page['page_id'] == PAGE_ID) {
$tempclass = $class.'-current';
} else {
$tempclass = $class;
}
// Check if link is same as first page link, and if so change to WB URL
if($page['link'] == $default_link AND !INTRO_PAGE) {
$link = WB_URL;
} else {
$link = page_link($page['link']);
}
// Generate menu links
echo '<a href="'.$link.'" target="'.$page['target'].'" class="'.$tempclass.'"><div class="'.$class.'-div">'.stripslashes($page['menu_title']).'</div></a>'."\n";
// Generate sub-menu each level will have and anditional -sub at hte end of the class so for a second lever menu it would be menuclass-sub, 2nd level menuclass-sub-sub adn so on and so forth.
if(isset($page_trail[$page['page_id']])) {
power_menu($page['page_id'], $menu_number, $menu_header, $menu_footer, $class.'-sub', $recurse-1);
}
}
// Print menu footer
echo $menu_footer;
}
}
and i used it as follows
power_menu(0, 1, '','');
if you don't like the name of the base css class "main-menu" a different class can be input when you call the function example
power_menu(0,1,'','','new-clss');
Menu's created with this function are very powerfull since you can simply define every element.