效果图:

代码:

<nav>
<ul id="starlist">
<li><a href="[!--news.url--]" class="<?=$GLOBALS[navclassid]?"":"hover"?>">首页</a></li>
<?php
$sql=$empire->query("select classid,sonclass,classname,islast,islist from {$dbtbpre}enewsclass where bclassid=0 and showclass=0 order by myorder,myorder asc");
while($s=$empire->fetch($sql)){
$tclass="";
$fr=explode('|',$class_r[$GLOBALS[navclassid]][featherclass]);
$topbclassid=$fr[1]?$fr[1]:$GLOBALS[navclassid];
if($topbclassid==$s[classid]){
$tclass='hover';
}
$classurl=sys_ReturnBqClassname($s,9);
echo '<li class="menu"><a href="'.$classurl.'" class='.$tclass.'>'.$s[classname].'</a>';
if(($s[islast]==0)&&($s[islist]==1)){
$sql2=$empire->query("select classid,classname from {$dbtbpre}enewsclass where bclassid=$s[classid] and showclass=0 order by myorder,myorder asc");
$str="";
while($s2=$empire->fetch($sql2)){
$classurl2=sys_ReturnBqClassname($s2,9);
$str.='<li><a href="'.$classurl2.'">'.$s2[classname].'</a></li>';
}
echo '<ul class="sub">'.$str.'</ul>';
}
echo '</li>';
}
?>
</ul>
</nav>

演示站地址:http://mwpz2.cncobo.com

<ul>
<li><a href="[!--news.url--]" class="<?=$GLOBALS[navclassid]?"":"hover"?>">首页</a></li>
<?php
$sql=$empire->query("select classid,sonclass,classname,islast,islist from {$dbtbpre}enewsclass where bclassid=0 and showclass=0 order by myorder,myorder asc");
while($s=$empire->fetch($sql)){
$tclass="";
$fr=explode('|',$class_r[$GLOBALS[navclassid]][featherclass]);
$topbclassid=$fr[1]?$fr[1]:$GLOBALS[navclassid];
if($topbclassid==$s[classid]){
$tclass='hover';
}
$classurl=sys_ReturnBqClassname($s,9);
echo '<li class="menu"><a href="'.$classurl.'" class='.$tclass.'>'.$s[classname].'</a>';   //一级分类开始样式
if(($s[islast]==0)&&($s[islist]==1)){
$sql2=$empire->query("select classid,classname from {$dbtbpre}enewsclass where bclassid=$s[classid] and showclass=0 order by myorder,myorder asc");
$str="";
while($s2=$empire->fetch($sql2)){
$classurl2=sys_ReturnBqClassname($s2,9);
$str.='<li><a href="'.$classurl2.'">'.$s2[classname].'</a></li>';   //二级分类下拉样式
}
echo '<ul class="sub">'.$str.'</ul>'; //二级总分类样式
}
echo '</li>';//一级分类结束样式
}
?>
        
    </ul>

 

声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。