帝国cms封面模板页循环调用当前栏目下的子栏目以及子栏目下的栏目以及信息
<!-- 循环开始 -->
<?php
$Result = sys_ReturnEcmsLoopBq("select classid,classname from {$dbtbpre}enewsclass where bclassid='$GLOBALS[navclassid]' order by myorder,classid asc",0,24,0);
while($IndexClass=$empire->fetch($Result)){
$ClassLink = sys_ReturnBqClassname($IndexClass,9);
?>
<div class="lm louti bj_mt26">
<div class="lm_l fl">
<div class="lm_title">
<h3 class="fl">
<em class="iconfont icon-xuexi1"></em>
<a href="<?=$ClassLink?>" target="_blank" title="<?=$IndexClass[classname]?>"><?=$IndexClass[classname]?></a>
</h3>
<div class="lm_nav1 tag fl">
[e:loop={"select * from phome_enewsclass where bclassid=$IndexClass[classid] order by classid asc limit 5",0,24,0}]
<a href="<?=$bqsr[classurl]?>" target="_blank" title="<?=$bqr[classname]?>" class="lm_btn"><?=$bqr[classname]?></a>
[/e:loop]
</div>
<a href="<?=$ClassLink?>" target="_blank" class="more cb fr">更多</a>
</div>
<div class="lm_rwap bj_mt30">
<div class="lm_itme fl">
<div class="pic_lb3">
<?php
$bqno=0;
$ResultG = sys_ReturnEcmsLoopBq($IndexClass[classid],1,0,1,'','onclick DESC');
while($ClassGoods=$empire->fetch($ResultG)){
$bqsr=sys_ReturnEcmsLoopStext($ResultG);
$bqsr=sys_ReturnEcmsLoopStext($ClassGoods);
$bqno++;
?>
<a href="<?=$ClassGoods[titleurl]?>" title="<?=$ClassGoods[title]?>" target="_blank" class="lb_img photo"><img src="<?=$ClassGoods[titlepic]?$ClassGoods[titlepic]:'/skin/images/'.rand(1,50).'.jpg'?>" alt="<?=$ClassGoods[title]?>"></a>
<a href="<?=$ClassGoods[titleurl]?>" title="<?=$ClassGoods[title]?>" target="_blank" class="lb_bt chao"><?=$ClassGoods[title]?></a>
<p class="chao2"><?=$ClassGoods[smalltext]?>...</p>
<?php
}
//显示1条
?>
</div>
<?php
$bqno=0;
$ResultG = sys_ReturnEcmsLoopBq($IndexClass[classid],'2,6',0,0,'','onclick DESC');
while($ClassGoods=$empire->fetch($ResultG)){
$bqsr=sys_ReturnEcmsLoopStext($ResultG);
$bqsr=sys_ReturnEcmsLoopStext($ClassGoods);
$bqno++;
?>
<a href="<?=$ClassGoods[titleurl]?>" title="<?=$ClassGoods[title]?>" target="_blank" class="lb_5 chao"><span>荐</span><?=$ClassGoods[title]?><time><?=date('m-d',$ClassGoods[newstime])?></time></a>
<?php
}
//显示6条
?>
</div>
<div class="lm_itme fr">
<div class="pic_lb3">
<?php
$bqno=0;
$ResultG = sys_ReturnEcmsLoopBq($IndexClass[classid],'1,1',0,1,'','onclick DESC');
while($ClassGoods=$empire->fetch($ResultG)){
$bqsr=sys_ReturnEcmsLoopStext($ResultG);
$bqsr=sys_ReturnEcmsLoopStext($ClassGoods);
$bqno++;
?>
<a href="<?=$ClassGoods[titleurl]?>" title="<?=$ClassGoods[title]?>" target="_blank" class="lb_img photo"><img src="<?=$ClassGoods[titlepic]?>" alt="<?=$ClassGoods[title]?>"></a>
<a href="<?=$ClassGoods[titleurl]?>" title="<?=$ClassGoods[title]?>" target="_blank" class="lb_bt chao"><?=$ClassGoods[title]?></a>
<p class="chao2"><?=$ClassGoods[smalltext]?>...</p>
<?php
}
//显示1条
?>
</div>
<?php
$bqno=0;
$ResultG = sys_ReturnEcmsLoopBq($IndexClass[classid],'1,6',0,0,'','newstime DESC');
while($ClassGoods=$empire->fetch($ResultG)){
$bqsr=sys_ReturnEcmsLoopStext($ResultG);
$bqsr=sys_ReturnEcmsLoopStext($ClassGoods);
$bqno++;
?>
<div class="lb_5 lb_6 chao">
<a href="<?=$bqsr['classurl']?>" target="_blank" title="<?=$bqsr['classname']?>" class="lb_lm"><?=$bqsr[classname]?></a>
<a href="<?=$ClassGoods[titleurl]?>" title="<?=$ClassGoods[title]?>" target="_blank" class="lb_bt"><?=$ClassGoods[title]?></a>
<time><?=date('m-d',$ClassGoods[newstime])?></time>
</div>
<?php
}
//显示6条
?>
</div>
</div>
</div>
<!-- 热门排行 -->
<div class="r_hot fr">
<div class="head head1"><h4 class="f16">热门排序</h4><span></span></div>
<ul class="lm_hot sideMen bj_mt20">
<?php
$bqno=0;
$ResultG = sys_ReturnEcmsLoopBq($IndexClass[classid],7,0,1,'','rand() DESC');
while($ClassGoods=$empire->fetch($ResultG)){
$bqsr=sys_ReturnEcmsLoopStext($ResultG);
$bqsr=sys_ReturnEcmsLoopStext($ClassGoods);
$bqno++;
?>
<?php //加入php代码
if ($bqno==1){ //指定第一条信息
$class = "on"; //第一条信息的样式
}
else{ //其它信息
$class = ""; //其它信息的样式
}
?>
<li class="lb_w1 <?=$class?>">
<a href="<?=$ClassGoods[titleurl]?>" title="<?=$ClassGoods[title]?>" target="_blank" class="lb_wimg"><em class="icon"></em></a>
<div class="lb_nr">
<span><?=$bqno?></span>
<a href="<?=$ClassGoods[titleurl]?>" title="<?=$ClassGoods[title]?>" target="_blank" class="lb_bt chao2"><?=$ClassGoods[title]?></a>
<a href="<?=$bqsr['classurl']?>" target="_blank" title="<?=$bqsr['classname']?>" class="lb_lm"><?=$bqsr['classname']?></a>
</div>
</li>
<?php
}
//显示7条
?>
</ul>
</div>
<!-- 热门排行 -->
<div class="clear"></div>
</div>
<?
}
?>
<!-- 循环结束 -->
示例页面
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。