帝国cms循环栏目调用文章,不是简单的从新闻表调用,支持不同模型数据调用。
<!-- 循环栏目调用 --> [e:loop={"select lm.classid,lm.classname,fj.en_title,lm.sonclass from {$dbtbpre}enewsclass lm left join {$dbtbpre}enewsclassadd fj on lm.classid=fj.classid where lm.bclassid=0 order by lm.myorder,lm.classid desc",0,24,0}] <div class="g-box-1200 g-beiyun"> <h2 class="clearfix g-tith2"> <p class="f-fl m-h2left"><i class="f-ico1 m-beiyun"></i><span><?=$bqr['classname']?></span><i><?=$bqr['en_title']?></i></p> <p class="f-fr m-h2right"></p> </h2> <dl class="clearfix"> <dt class="f-fl m-inleft f-hovertab-box"> <div class="m-tit3"> <ul class="clearfix f-lifl f-hovertab-btn"> <?php $sql=$empire->query("select * from {$dbtbpre}enewsclass where bclassid={$bqr['classid']} order by myorder,classid limit 6"); $list=array(); while($r=$empire->fetch($sql)) { $list[]=$r['classid']; ?> <li><a href="<?=sys_ReturnBqClassname($r,9)?>" target="_blank"><?=$r['classname']?></a></li> <?php } ?> </ul> </div> <?php foreach ($list as $k0=>$v0){ $tbname=$class_r[$v0]['tbname']; ?> <div class="f-hovertab-cont clearfix m-bydiv" <?php if($k0>0)echo 'style="display:none"'; ?>> <?php $r=$empire->fetch1("select * from {$dbtbpre}ecms_".$tbname." where classid='{$v0}' and isgood=1 and bigpic != '' order by newstime desc limit 1"); $showedid=$r['id']; $whereshowid=''; ?> <div class="m-imgnew m-big f-fl"> <?php if($r){ ?> <a href="<?=sys_ReturnBqTitleLink($r)?>" title="<?=$r['title']?>" target="_blank"> <img src="<?=$r['bigpic']?>" alt="<?=$r['title']?>"> <p><?=$r['title']?></p> </a> <?php } ?> </div> <div class="f-fr m-inbyright"> <ul class="clearfix f-lifl m-inbyul"> <?php if($showedid)$whereshowid=" and id not in(".trim($showedid,',').")"; $sql=$empire->query("select * from {$dbtbpre}ecms_".$tbname." where classid='{$v0}' {$whereshowid} and titlepic != '' order by newstime desc limit 2"); while($r=$empire->fetch($sql)) { $showedid.=','.$r['id']; ?> <li><div class="f-tw"> <a href="<?=sys_ReturnBqTitleLink($r)?>" title="<?=$r['title']?>" target="_blank"> <img src="<?=$r['titlepic']?>" alt="<?=$r['title']?>"> <p><span><?=$r['title']?></span></p> </a> </div></li> <?php } ?> </ul> <ul class="m-newtopsul"> <?php if($showedid)$whereshowid=" and id not in(".trim($showedid,',').")"; $sql=$empire->query("select * from {$dbtbpre}ecms_".$tbname." where classid='{$v0}' $whereshowid order by newstime desc limit 7"); while($r=$empire->fetch($sql)) { $showedid.=','.$r['id']; ?> <li><span class="f-fr"><?=date('m-d',$r['newstime'])?></span><span class="f-fl"></span><a href="<?=sys_ReturnBqTitleLink($r)?>" title="<?=$r['title']?>" target="_blank"><?=$r['title']?></a></li> <?php } ?> </ul> </div> </div> <?php } ?> </dt> <dd class="f-fr m-inright"> <h5 class="m-intit"><div>热点<span>文章</span></div><p>HOT ARTICLE</p></h5> <ul class="m-hotgul"> <?php $sonclass=str_replace('|',',',trim($bqr['sonclass'].$bqr['classid'],'|')); if($showedid)$whereshowid=" and id not in(".trim($showedid,',').")"; $sql=$empire->query("select * from {$dbtbpre}ecms_news where classid in ({$sonclass}) $whereshowid and titlepic != '' order by onclick desc limit 2"); while($r=$empire->fetch($sql)) { $showedid.=','.$r['id']; ?> <li><a href="<?=sys_ReturnBqTitleLink($r)?>" title="<?=$r['title']?>" target="_blank" class="clearfix"><p class="f-fl"><img src="<?=$r['titlepic']?>" alt="<?=$r['title']?>"></p><strong><?=$r['title']?></strong><span><?=date('Y-m-d',$r['newstime'])?></span></a></li> <?php } ?> </ul> <ul class="m-blphul"> <?php if($showedid)$whereshowid=" and id not in(".trim($showedid,',').")"; $sql=$empire->query("select * from {$dbtbpre}ecms_news where classid in ({$sonclass}) $whereshowid order by onclick desc limit 4"); $k1=0; while($r=$empire->fetch($sql)) { $k1++; ?> <li class="f-ix f-t3"><a href="<?=sys_ReturnBqTitleLink($r)?>" title="<?=$r['title']?>" target="_blank" class="m-nsmall"><em><?=$k1?></em><?=$r['title']?></a></li> <?php } ?> </ul> </dd> </dl> </div> [/e:loop]
如果本文对你有帮助,欢迎打赏本站