电脑安全

您当前的位置:主页 > 电脑安全 >

帝国cms首页,封面页 循环调用子栏目信息以及头

来源:[db:来源]标题:   变量    编辑:电脑技术全能网 时间:2019-09-18 12:30

原标题:帝国cms首页,封面页 循环调用子栏目信息以及头
   封面模板 能够完成轮回子栏目以及头条挪用,然而头条的图片和题目只能用一条,只要应用灵动标签。完成后果如图:<?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 classidin $bclassidorder 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 classidin $bclassidorder bymyorderasc ",0,24,0}] <div class="newsitem"> <div class="newspic"> <ul><?php//这里是获得该分类下的有图片的最新数据$commbook=$empire->query("select * fromjxhx_ecms_newswhere 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_newswhere 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-->完成后果如图:轮回挪用扩大变量外面的id号,依照后盾次序排序,myorder,图片调的是头条。列表为5条