Skip to main content
 仿站网 » 仿站教程 » 帝国cms教程

帝国cms灵动标签循环调用栏目文章

2019年03月29日23220百度已收录

第一步,增加公共模板变量





代码如下:
 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
    <div class="newsbox">
[e:loop={"select * from [!db.pre!]enewsclass where classid in (1,2,3,4)  order by myorder asc ",0,24,0}]
<?php
$classurl=sys_ReturnBqClassname($bqr,9);//取得栏目地址
?>
 
      <section>
        <div class="news">
          <h2 class="newstitle"><span><a href="<?=$classurl?>"  target="_blank">更多</a></span><b><?=$bqr[classname]?></b></h2>
          <ul>
<?php
//取得该分类下的最新数据
  
    $newbook=$empire->query("select * from  {$dbtbpre}ecms_news  where classid =".$bqr[classid]." order by newstime desc limit 8");
     
    while($r=$empire->fetch($newbook)) {
    ?>
<li><a href="<?=sys_ReturnBqTitleLink($r)?>" target="_blank"><span><?=date('Y-m-d',$r[newstime])?></span><?=DoTitleFont($r[titlefont],$r[title])?></a> </li>
    <?php
     }
    ?>
          </ul>
        </div>
      </section>
 
       [/e:loop]  
</div>

第二步,将[!--temp.listnews--]复制,粘贴到首页模板




第三步,添加css,修改skin/jxhx/css/base.css 

1
2
3
4
5
6
7
8
9
10
11
12
13
/*newsbox*/
.newsbox {overflowhidden;margin-bottom10px;}
.newsbox section {width49.5%;floatleft;margin-bottom10px;}
.newsbox section:nth-child(odd){ float:right}
.newsbox .news {background#fff;border1px solid #E1E1E1;}
.newstitle { line-height40pxfont-size15pxborder-bottom1px solid #E1E1E1background#F8F8F8 url(../images/newslist.png) no-repeat left 14px centerpadding0 20px 0 46pxfont-weightnormal }
.newstitle span { floatrightfont-size14px }
.newstitle span a { color#666 }
.newstitle b { displayblockborder-left1px solid #E1E1E1padding-left10px }
.newsbox .news ul { padding10px }
.newsbox .news ul li { display: inline-blockoverflowhidden; text-overflow: ellipsis; white-spacenowrapheight28pxwidth96%line-height28pxfont-size14pxbackgroundurl(../images/li.png) no-repeat left centerpadding-left15px; }
.newsbox .news ul li span { floatrightcolor#999font-size12pxmargin-left20px }
.newsbox .news ul li a:hover { color#09B1B9; }


第四步,上传图片li.jpg,newslist.png到skin/jxhx/images/

评论列表暂无评论
发表评论取消回复
微信