帝国cms同时调用一级、二级栏目并当前栏目高亮显示的方法
调用一二级栏目高亮显示
方法一、判断是否 有二级 栏目(判断是否存在子栏)
方法二、帝国cms设置,一级栏目高亮,并且二级栏目增加一个类名,class=”sub”。用灵动标签可以实现,先获取一级栏目的地址,然后再判断是否是终极栏目,是的话,就添加样式sub,不是终极栏目就为空
- 网站首页
[e:loop={"select classid,classname,islast,showclass from {$dbtbpre}enewsclass where bclassid=0 and showclass=0 order by myorder,classid asc",0,24,0}]
<li ><a href="">
<?php
if(!$bqr[islast]) //判断是否终极栏目
{
$classsub='';
$classsubend='
';
}
else
{
$classsub='';
$classsubend='';
}
{
?>
query("select classid,classname from ".$dbtbpre."enewsclass where bclassid=".$bqr[classid]." order by myorder,classid desc");
while($classr=$empire->fetch($newsclass))
{
$classrurl=sys_ReturnBqClassname($classr,9); //取得子栏目地址
?>
- <a href="" >
[/e:loop]
方案三:一级栏目高亮“selected”,并且增加样式“menu”
- 首页
[e:loop={"select classid,classname,islast from {$dbtbpre}enewsclass where bclassid=0 order by myorder,classid asc",0,24,0}]
<li ><a href="">
query("select classid,classname from ".$dbtbpre."enewsclass where bclassid=".$bqr[classid]." order by myorder,classid desc");
while($classr=$empire->fetch($newsclass))
{
$classrurl=sys_ReturnBqClassname($classr,9); //取得子栏目地址
?>
- <a href="" target="_blank">
[/e:loop]
.selected > a{color:red}
方案四:父栏目高亮
[e:loop={"select classid,classname from {$dbtbpre}enewsclass where bclassid=0 and showclass=0 order by myorder,classid asc",0,24,0}]
<a class="navSecA " href="">
[/e:loop]
方案五:栏目高亮
<li class="">首页
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)){
$classurl=sys_ReturnBqClassname($s,9);
$tclass="";
$fr=explode('|',$class_r[$GLOBALS[navclassid]][featherclass]);
$topbclassid=$fr[1]?$fr[1]:$GLOBALS[navclassid];
if($topbclassid==$s[classid]){
$tclass='current-menu-item';
}
echo ''.$s[classname].'';
if($s[islast]==0){
$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.=' '.$s2[classname].' ';
}
echo ' ';
}
echo '';
}
?>
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。