--- In php-objects@xxxxxxxxxxxxxxx, "nickmarinho@..." <nickmarinho@...> wrote: > > javascript > > My Php wrote: > > > > > > How to make tree menu? Plz reply ... > > > // To display top category menus function dispTopMenuGlossy($colors,$justify) { //echo MODERATOR; exit; $sql = "SELECT * FROM ".TBLPAGES." WHERE ".PAGEPARENTID."=0 AND ".PAGETOPMENU."=1 AND ".PAGELISTORDER."<>0 AND ".PAGEACTIVE."=0 ORDER BY ".PAGELISTORDER.""; $rs = $GLOBALS['db_obj']->select($sql); if(count($rs)>0) { ?> <ul id="nav"> <? foreach($rs as $val){ ?> <li class="page_item"><a href='<?=HOSTADD?>/<?=$_SESSION['moderator']?><?=str_replace("'","",str_replace(" ","",html_entity_decode(stripslashes(trim($val[PAGECATEGORYNAME])))))?>.htm' rel="ddsubmenu<?=$val[PAGEID]?>" ><?=ucwords(html_entity_decode(stripslashes($val[PAGECATEGORYNAME])))?></a> <? $sqlmain = "SELECT * FROM ".TBLPAGES." WHERE ".PAGEACTIVE."=0 AND ".PAGETOPMENU."=1 AND ".PAGEPARENTID."=".$val['pageid']." ORDER BY ".PAGELISTORDER.""; $rsmain = $GLOBALS['db_obj']->select($sqlmain); if(count($rsmain)>0) { ?> <ul width="150" id="ddsubmenu<?=$val[PAGEID]?>" class="ddsubmenustyle"> <? $sql1 = "SELECT * FROM ".TBLPAGES." WHERE ".PAGEACTIVE."=0 AND ".PAGETOPMENU."=1 AND ".PAGEPARENTID."=".$val['pageid']." ORDER BY ".PAGELISTORDER.""; $rs1 = $GLOBALS['db_obj']->select($sql1); if(count($rs1)>0) { foreach($rs1 as $val1) { if($val1['pagecategoryname']<>"") { $url = $host.str_replace("'","",str_replace(" ","",html_entity_decode(stripslashes(trim($val1['pagecategoryname']))))).".htm"; ?> <li class="page_item"><a href="<?=$url?>" class="page_item" style="background-color:<?=$colors['Category_Menu']?>;"><?=html_entity_decode(stripslashes(trim($val1['pagecategoryname'])))?></a></li> <? } } } ?> </ul> <? } ?> </li> <? } ?> </ul> <? } } =========================================================== <? ?> <!-- Top Menu Start --> <?$this->dispTopMenuGlossy($colors,$editorsarea['topmenuheader']);?> <!-- Top Menu End--> <? ?> =============================================================== <script language="javascript"> startList = function() { if (document.all&&document.getElementById) { navRoot = document.getElementById("nav"); for (i=0; i<navRoot.childNodes.length; i++) { node = navRoot.childNodes[i]; if (node.nodeName=="LI") { node.onmouseover=function() { this.className+=" over"; } node.onmouseout=function() { this.className=this.className.replace» (" over", ""); } } } } } window.onload=startList; </script> ====================================================== ul { margin: 0; padding: 0; list-style: none; width: auto; border-bottom: 1px solid #ccc; } ul li { position: relative; width:auto; } li ul { position: absolute; left: 0px; top: 25px; display: none; } ul li a { display: block; text-decoration: none; color: #777; background: #fff; padding: 5px; border: 1px solid #ccc; border-bottom: 0; } /* Fix IE. Hide from IE Mac \*/ * html ul li { float: left; } * html ul li a { height: 1%; } /* End */ li:hover ul { display: block; } li:hover ul, li.over ul { display: block; }