东方星雨

简单网络

一个爱好网络的80后男站长。

关注我东方星雨个人微信号:476847113

您现在的位置是:首页 > 站长日志

帝国cms循环子栏目和栏目下文章+高亮代码

2019-01-04 站长 站长日志

[e:loop={"select classid, classname, classpath from `[!db.pre!]enewsclass` where bclassid='2' order by `classid` desc ",7,24,0}]
<dl class="lbox" <?php $i++; if($i%2==0){ echo 'id="gl_01"';}  //这里加了个判断,偶数行输出id="gl_01,奇数不输出 ?>>
<?php

//这里是取得该分类下的有图片的最新数据
$commbook=$empire->fetch1("select title,titlepic,smalltext,titleurl,keyboard,groupid,classid,newspath,filename,id from {$dbtbpre}ecms_news where classid = ".$bqr[classid]." and titlepic!='' order by newstime desc limit 1");
$commbookurl=sys_ReturnBqTitleLink($commbook);
?>
<dt>
  <h5><a href="<?=$public_r[newsurl].$bqr[classpath]?>"><?=$bqr[classname]?></a></h5>
  <span class="more"><a href="<?=$public_r[newsurl].$bqr[classpath]?>">更多</a></span></dt>
<dd>
  <ul class="list">
  <li class="p1"><a href="<?=$commbookurl?>" target="_blank"><img src="<?=$commbook[titlepic]?>" width="108px" height="85px" /></a><a href="<?=$commbookurl?>" target="_blank"><?=esub($commbook[title],28)?></a>
<p><?=esub($commbook[smalltext],64)?>...</p>
  </li>
    <?php
//取得该分类下的最新数据

    $newbook=$empire->query("select title,titlepic,smalltext,titleurl,keyboard,newstime,groupid,classid,newspath,filename,id from {$dbtbpre}ecms_news  where classid =".$bqr[classid]." order by newstime desc limit 5");
   
    while($r=$empire->fetch($newbook)) {
    ?>
    <li><a href="<?=sys_ReturnBqTitleLink($r)?>" title="<?=$r[title]?>"><?=$r[title]?></a><span><?=date('Y-m-d',$r[newstime])?></span></li>
    <?php
     }
     //显示5条
    ?>
  </ul>
   </dd>
  </dl>
  [/e:loop]

文章评论