封面模板 可以实现循环子栏目以及头条调用,但是头条的图片和标题只能用一条,只有使用灵动标签。
实现效果如图:
<?php $bclassid=$GLOBALS[navclassid]; //取得本栏目id //取得本栏目下的子栏目 ?> [e:loop={"select classid, classname, classpath from `[!db.pre!]enewsclass` where bclassid='$bclassid' order by `classid` desc ",7,24,0}] <div class="fengm"> <h3><span><a href="<?=$public_r[newsurl].$bqr[classpath]?>" target="_blank">更多+</a></span> <?=$bqr[classname]?> </h3> <div class="fpicbox"> <ul> <?php //这里是取得该分类下的有图片的最新数据 $commbook=$empire->query("select * from [!db.pre!]ecms_news where classid = ".$bqr[classid]." and titlepic!=' ' order by newstime desc limit 3"); $commbookurl=sys_ReturnBqTitleLink($commbook); while($r=$empire->fetch($commbook)) { ?> <li class="fpic"><a href="<?=sys_ReturnBqTitleLink($r)?>"><img src="<?=$r[titlepic]?>" ><i> <?=$r[title]?> </i></a></li> <?php } ?> </ul> </div> <ul class="fmnews"> <?php //取得该分类下的最新数据 $newbook=$empire->query("select title,titlepic,smalltext,titleurl,keyboard,newstime,groupid,classid,newspath,filename,id from [!db.pre!]ecms_news where classid =".$bqr[classid]." order by newstime desc limit 5"); while($r=$empire->fetch($newbook)) { ?> <li><span> <?=date('Y-m-d',$r[newstime])?> </span><a href="<?=sys_ReturnBqTitleLink($r)?>" title="<?=$r[title]?>"> <?=$r[title]?> </a></li> <?php } //显示5条 ?> </ul> </div> [/e:loop]
如果首页改用扩展变量,可以这么做 :系统-扩展变量-增加一个变量名为title
<div class="tab_box whitebg"> <?php $bclassid=ReturnPublicAddVar('title'); //取得栏目id,系统,扩展变量 ?> <div class="tab_buttons"> <ul> [e:loop={"select classid, classname, classpath from [!db.pre!]enewsclass where classid in $bclassid order by myorder asc ",0,24,0}] <? if($bqno==1) { ?> <li class="newscurrent"><a href="javascrpt::"> <?=$bqr[classname]?> </a></li> <?php } else{ ?> <li><a href="javascrpt::"> <?=$bqr[classname]?> </a></li> <? } ?> [/e:loop] </ul> </div> <div class="newstab"> [e:loop={"select classid, classname, classpath from [!db.pre!]enewsclass where classid in $bclassid order by myorder asc ",0,24,0}] <div class="newsitem"> <div class="newspic"> <ul> <?php //这里是取得该分类下的有图片的最新数据 $commbook=$empire->query("select * from jxhx_ecms_news where classid = ".$bqr[classid]." and titlepic!=' ' and isgood=1 order by newstime desc limit 2"); $commbookurl=sys_ReturnBqTitleLink($commbook); while($r=$empire->fetch($commbook)) { ?> <li><a href="<?=sys_ReturnBqTitleLink($r)?>"><img src="<?=$r[titlepic]?>"><span> <?=$r[title]?> </span></a></li> <?php } ?> </ul> </div> <ul class="newslist"> <?php //取得该分类下的最新数据 $newbook=$empire->query("select * from jxhx_ecms_news where classid =".$bqr[classid]." order by newstime desc limit 5"); while($r=$empire->fetch($newbook)) { ?> <li><i></i><a href="<?=sys_ReturnBqTitleLink($r)?>" title="<?=$r[title]?>"> <?=esub($r[title],60,'...')?> </a> <p> <?=$r[smalltext]?> </p> </li> <?php } //显示5条 ?> </ul> </div> [/e:loop] </div> </div> <!--tab_box end-->
当前仅支持登录后发布评论