您当前的位置:首页 > 网络教程 > 帝国CMS教程

3.8 应用举例 标题分类

常用代码

<?php
$ttids_sql=sys_ReturnEcmsLoopBq("select ttids from [!db.pre!]enewsclassadd where classid=$GLOBALS[navclassid]",0,24,0);
while($bqr=$empire->fetch($ttids_sql)){
$ttids=explode(',',trim($bqr[ttids],","));
foreach($ttids as $id){
$ttname_sql=sys_ReturnEcmsLoopBq("select tname from [!db.pre!]enewsinfotype where typeid=$id",0,24,0);
while($bqr2=$empire->fetch($ttname_sql)){
?>
<h2><?=$bqr2[tname]?></h2>
<ul>
[e:loop={'selfinfo',50,0,0,"ttid='$id'"}]
<li><a href="<?=$bqsr[titleurl]?>"><?=$bqr[title]?></a></li>
[/e:loop]
</ul>
<?php}
}
}?>

增加序列号

<?php
$ttids_sql=sys_ReturnEcmsLoopBq("select ttids from [!db.pre!]enewsclassadd where classid=$GLOBALS[navclassid]",0,24,0);
while($bqr=$empire->fetch($ttids_sql)){
$j=0;
$ttids=explode(',',trim($bqr[ttids],","));
foreach($ttids as $id){
$ttname_sql=sys_ReturnEcmsLoopBq("select tname from [!db.pre!]enewsinfotype where typeid=$id",0,24,0);
while($bqr2=$empire->fetch($ttname_sql)){
$j++;
?>
<h2><i><?php echo $j?></i><?=$bqr2[tname]?></h2>
[e:loop={'selfinfo',50,0,0,"ttid='$id'",'id asc'}]
<li><a href="<?=$bqsr[titleurl]?>" target="_blank"><?=$bqr[title]?></a></li>
[/e:loop] 
<?php
}
}
}
?>

你觉得文章内容怎么样

阿里云代金券 100 云产品通用

有效期30天 首购用户

立即领取
阿里云代金券 100 云产品通用

有效期30天 复购+升级

立即领取