帝国CMS高级应用—灵动标签调用二级导航 循环子栏目和信息:
<div class="nav"><div class="nav"> <div class="nav-inner"> <div class="clearfix nav-inner" id="menu"> <ul class="navlist"> <li><a href="[!---news.url--]"><span>网站首页</span></a></li><!-- class="current"-->[e:loop={"select classid,classname,islast,sonclass from {$dbtbpre}enewsclass where bclassid='0' order by myorder,classid ASC limit 11",0,24,0}]<?php$classurl=sys_ReturnBqClassname($bqr,9); //取得栏目地址$tbname=$class_r[$bqr[classid]][tbname]; //取得表名$navshow=ReturnClassAddField($bqr[classid],'nav'); //取得栏目自定义字段navshow值?> <li><a href="<?=$classurl?>" target="_blank"><span><?=$bqr[classname]?></span></a><?php//值为0时显示二级,值为1时不显示二级if(!$navshow){ //终极栏目Start if(!$bqr[islast]) { //判断是否有子栏目Start if($bqr[sonclass]) { echo '<ul>'; //循环栏目下的子栏目Start $newsclass=$empire->query("select classid,classname from ".$dbtbpre."enewsclass where bclassid=".$bqr[classid]." order by myorder,classid desc limit 10"); while($classr=$empire->fetch($newsclass)) { $classrurl=sys_ReturnBqClassname($classr,9); //取得子栏目地址 ?> <li><a href="<?=$classrurl?>"><?=$classr[classname]?></a></li> <?php } //循环栏目下的子栏目End echo '</ul>'; } //判断是否有子栏目End } //终极栏目End else //非终极栏目Start { $numinfo=$empire->gettotal("select count(*) as total from ".$dbtbpre."ecms_".$tbname." where classid=".$bqr[classid]); //统计子栏目信息 //判断终极栏目下是否有信息Start if($numinfo) { echo '<ul>'; //循环栏目下的信息Start $newsinfo=$empire->query("select title,id,classid,newspath,filename,groupid,titleurl from ".$dbtbpre."ecms_".$tbname." where classid=".$bqr[classid]." order by newstime desc limit 10"); while($infor=$empire->fetch($newsinfo)) { $titleurl=sys_ReturnBqTitleLink($infor); ?> <li><a href="<?=$titleurl?>"><?=$infor[title]?></a></li> <?php } //循环栏目下的信息End echo '</ul>'; } //判断终极栏目下是否有信息End } //非终极栏目End }?> </li>[/e:loop] </ul> </div> </div> </div>
新闻热点
疑难解答