Posted: Thu 23. Sep 2004, 12:33
Meybe someone has solution about how to make this menu horizontal plz.?
The phpwcms support forum will help to find answers to your questions. The small but strong community is here since more than 10 years.
https://forum.phpwcms.org/
Code: Select all
enable_menues_for_ie();
Code: Select all
style: horizontal
<style>
/****************** BEGIN required for menu functionality, DO NOT CHANGE! ******************/
ul.dropdown
{
list-style: none;
margin:0;
padding:0;
width:100%;
}
ul.dropdown * ul
{
list-style: none;
margin:0;
padding: 0;
display:none;
position:absolute;
z-index:99;
}
ul.dropdown li
{
float:left;
padding:2px; /* helps Opera with hover - do not remove! */
}
ul.dropdown li * li
{
float:none;
position: relative; /* required? */
}
ul.dropdown ul * ul
{
left:98%;
top:0;
width:100%;
}
ul.dropdown a
{
display:block;
}
ul.dropdown ul * a
{
width:13em;
}
ul.dropdown li:hover ul ul, ul.dropdown li:hover ul ul ul, ul.dropdown li:hover ul ul ul ul
{
display:none;
}
ul.dropdown li:hover ul, ul.dropdown ul li:hover ul, ul.dropdown ul ul li:hover ul
{
display:block;
}
/****************** END required for menu functionality, DO NOT CHANGE! ******************/
/**************** eyecandy *****************/
body
{
font-family:verdana;
}
ul.dropdown a
{
background-color:#f0f0f0;
color:#444;
padding:4px;
text-decoration:none;
}
ul.dropdown a:hover
{
background-color:#444;
color:#fff;
}
ul.dropdown ul
{
border:1px outset;
}
ul.dropdown ul a
{
background-color:#ccc;
color:#000;
padding:4px;
text-decoration:none;
}
ul.dropdown ul a:hover
{
background-color:#f0f0f0;
color:#000;
}
ul.dropdown ul li
{
background-color:#ccc;
}
</style>
Code: Select all
for vertical version
<style>
/****************** BEGIN required for menu functionality, DO NOT CHANGE! ******************/
ul.dropdown
{
list-style: none;
margin:0;
padding:0;
width:100%;
}
ul.dropdown * ul
{
list-style: none;
margin:0;
padding: 0;
display:none;
position:absolute;
z-index:99;
}
ul.dropdown li
{
float:left;
padding:2px; /* helps Opera with hover - do not remove! */
}
ul.dropdown li * li
{
float:none;
position: relative; /* required? */
}
ul.dropdown ul * ul
{
left:98%;
top:0;
width:100%;
}
ul.dropdown a
{
display:block;
}
ul.dropdown ul * a
{
width:13em;
}
ul.dropdown li:hover ul ul, ul.dropdown li:hover ul ul ul, ul.dropdown li:hover ul ul ul ul
{
display:none;
}
ul.dropdown li:hover ul, ul.dropdown ul li:hover ul, ul.dropdown ul ul li:hover ul
{
display:block;
}
/****************** END required for menu functionality, DO NOT CHANGE! ******************/ </style>
Code: Select all
css_dropdown.js
function enable_menues_for_ie()
{
if (document.all)
{
uls = document.getElementsByTagName('UL');
for(i = 0; i < uls.length; i++)
{
if (uls[i].className == 'dropdown')
{
var lis = uls[i].getElementsByTagName('li');
for (j = 0; j < lis.length; j++)
{
if(lis[j].lastChild.tagName == 'UL')
{
lis[j].onmouseover = function() { this.lastChild.style.display = 'block'; }
lis[j].onmouseout = function() { this.lastChild.style.display = 'none'; }
}
}
}
}
}
}
window.onload = enable_menues_for_ie;
Code: Select all
php code to generate the list... (without active level)
function build_dhtmlmenu($start=0, $class, $counter=0) {
$s = '';
$g = '';
foreach($GLOBALS['content']['struct'] as $key => $value) {
if ($start == $GLOBALS['content']['struct'][$key]['acat_struct'] &&
!$GLOBALS['content']['struct'][$key]['acat_hidden'] && $key)
{
$s .= '<li>';
if(!$GLOBALS['content']['struct'][$key]["acat_redirect"]) {
$s .= '<a href="index.php?';
if($GLOBALS['content']['struct'][$key]['acat_alias']) {
$s .= $GLOBALS['content']['struct'][$key]['acat_alias'];
} else {
$s .= 'id='.$key.',0,0,1,0,0';
}
$s .= '">';
} else {
$redirect = get_redirect_link($GLOBALS['content']['struct'][$key]["acat_redirect"], ' ', '');
$s .= '<a href="'.$redirect['link'].'"'.$redirect['target'].'>';
}
$s .= html_specialchars($GLOBALS['content']['struct'][$key]['acat_name']);
$s .= '</a>';
$s .= build_dhtmlmenu($key, $class, $counter+1);
$s .= "</li>\n";
}
}
if($s) {
$g = "\n<ul";
if(!$counter && $class) $g .= ' '.$class;
$g .= ">\n".$s.'</ul>';
}
return $g;
}
Code: Select all
php code to generate the list (with active level)
function build_dhtmlmenu($start=0, $class='', $activeclass='', $counter=0) {
$s = '';
$g = '';
foreach($GLOBALS['content']['struct'] as $key => $value) {
if ($start == $GLOBALS['content']['struct'][$key]['acat_struct'] &&
!$GLOBALS['content']['struct'][$key]['acat_hidden'] && $key)
{
$s .= '<li';
if($key == $GLOBALS['aktion'][0] && $activeclass) $s .= ' '.$activeclass;
$s .= '>';
if(!$GLOBALS['content']['struct'][$key]["acat_redirect"]) {
$s .= '<a href="index.php?';
if($GLOBALS['content']['struct'][$key]['acat_alias']) {
$s .= $GLOBALS['content']['struct'][$key]['acat_alias'];
} else {
$s .= 'id='.$key.',0,0,1,0,0';
}
$s .= '">';
} else {
$redirect = get_redirect_link($GLOBALS['content']['struct'][$key]["acat_redirect"], ' ', '');
$s .= '<a href="'.$redirect['link'].'"'.$redirect['target'].'>';
}
$s .= html_specialchars($GLOBALS['content']['struct'][$key]['acat_name']);
$s .= '</a>';
$s .= build_dhtmlmenu($key, $class, $counter+1);
$s .= "</li>\n";
}
}
if($s) {
$g = "\n<ul";
if(!$counter && $class) $g .= ' '.$class;
$g .= ">\n".$s.'</ul>';
}
return $g;
}