代码一、SQL语句灵动标签结合万能标签循环子栏目及信息;
1、有样式!!!
循环子栏目+信息
//取得栏目id信息,id=3
<?php
$bclassid='3';
?>
<div class="md_box">
<ul id="tabs">[e:loop={"select classid,classname from {$dbtbpre}enewsclass where bclassid=$bclassid order by myorder,classid asc",0,24,0}]
<li <?if($bqno==1){echo 'class="tabs-current"';}?>><?=$bqr['classname']?></li>[/e:loop]</ul>
<div id="tabs-content" class="md_list">
[e:loop={"select classid,classname from {$dbtbpre}enewsclass where bclassid=$bclassid order by myorder,classid asc",0,24,0}]
[ecmsinfo] $bqr[classid],3,0,1,1,20,1,0,0[/ecmsinfo]
[/e:loop]
</div>
</div>
帝国cms万能标签语法规则:
[ecmsinfo]栏目ID,显示条数,标题截取数,是否显示栏目名,操作类型,模板ID,只显示有标题图片,附加SQL条件,显示排序[/ecmsinfo]
//展示
[ecmsinfo] $bqr[classid],3,0,1,1,20,1,0,0[/ecmsinfo]
在标签模板中增加一个模板标签ID=20
页面模板内容
<section class="自定义CSS>
<ul>
[!--empirenews.listtemp--]<!--list.var1-->[!--empirenews.listtemp--]
</ul>
</section>
列表内容模板:
注意:注意勾选“使用程序代码”
$listtemp='
<li><a href="[!--titleurl--]" target="_blank"><i class="md_img"><img src="[!--titlepic--]"></i><div class="desc"><h3>[!--title--]</h3><div class="local">'.$class_r[$r[classid]]['classname'].'</div>
<p class="meta"><span>特点:</span>[!--smalltext--]</p>
<p class="price"><i>¥价格:</i> <span>[!--price--]</span>起</p></div><p class="rain-bow c_orange">精选</p>
</a></li>';
2、无样式!!!
<?php
$bclassid = $GLOBALS[ navclassid ];
//取得本栏目id
?>
<div class="tab" >
<span><?=$class_r[$bclassid]['classname']?></span>
</div>
<div class="">
[e:loop={"select classid,classname from {$dbtbpre}enewsclass where bclassid=$bclassid order by myorder,classid asc",0,24,0}]
<li class="sidebar-nav-li" data-level="1.0.1"><span class="chapter">
<?=$bqr['classname']?>
</span>
<ul>
[ecmsinfo]$bqr[classid],50,30,0,0,25,0,'','id ASC'[/ecmsinfo]
</ul>
</li>
[/e:loop]
</div>
页面模板内容(*)
[!--empirenews.listtemp--]<!--list.var1-->[!--empirenews.listtemp--]
列表内容模板(list.var) (*)
<li class="active" ><a href="#[!--title--]" title="[!--oldtitle--]">[!--no.num--]、[!--title--]</a></li>
代码2:终极栏目循环当前栏目下所有文章信息;
<?php
$bclassid = $GLOBALS[ navclassid ];
//取得本栏目id
?>
<div class="tab" > <span>
<?=$class_r[$bclassid]['classname']?>
</span> </div>
<div class="">
<li class='sidebar-nav-li' data-level='1.0.1'><span class='chapter'>
<?=$class_r[$bclassid]['classname']?>
</span>
<ul>
[e:loop={'selfinfo',100,0,0,"id<>'$navinfor[id]'",'id asc'}]
<li class="active" ><a href="#<?=$bqr['title']?>" title="<?=$bqr['oldtitle']?>">
<?=$bqno?> 、<?=$bqr['title']?>
<code>//注释!!</code>
<code>//$bqno 就是序列号。默认从1开始 </code>
<code>//要从2开始就 $bqno+1 </code>
<code>//要从3开始就 $bqno+2 </code>
</a></li>
[/e:loop]
</ul>
</li>
</div>
代码3:栏目循环当前栏目下所有子栏目及文章信息;
//测试 正常 注意: class 中的"" 务必改为'' 否则 生成失败!
//<a href='" . $classurl . "'>" . $proMenu_sub[ classname ] . "</a>
//<a href='".$titleurl."'>".$proMenu_arti[title]."</a>
//<a href='#" . $proMenu_arti[ title ] . "'>" . $no . "、" . $proMenu_arti[ title ] . "</a>
<?php
$bclassid = $GLOBALS[ navclassid ];
//取得本栏目
id
?>
<div class="tab" >
<span><?=$class_r[$bclassid]['classname']?></span>
</div>
<div class="">
<?php
$mesql = $empire->query( "select bclassid,classname,classid,sonclass,classpath from {$dbtbpre}enewsclass where bclassid in (2) order by myorder,classid" );
while ( $proMenu = $empire->fetch( $mesql ) ) {
$classurl = sys_ReturnBqClassname( $proMenu, 9 ); //栏目链接
echo "<li class='sidebar-nav-li' data-level='1.0.1'><span class='chapter'>" . $proMenu[ classname ] . "</span>";
if ( $proMenu[ sonclass ] ) { //有子栏目是非终极栏目 列出子栏目
$mesql_sub = $empire->query( "select classname,classid,sonclass,classpath from {$dbtbpre}enewsclass where bclassid=" . $proMenu[ classid ] );
echo "<ul>";
while ( $proMenu_sub = $empire->fetch( $mesql_sub ) ) {
$classurl = sys_ReturnBqClassname( $proMenu_sub, 9 ); //栏目链接
echo "<li class='active'><a href='" . $classurl . "'>" . $proMenu_sub[ classname ] . "</a></li>";
$mesql_arti = $empire->query( "select * from {$dbtbpre}ecms_news where classid=" . $proMenu_sub[ classid ] );
echo "<ul class='ary_wk'>";
$no = 0;
while ( $proMenu_arti = $empire->fetch( $mesql_arti ) ) {
$titleurl = sys_ReturnBqTitleLink( $proMenu_arti ); //标题链接
$no++;
echo "<li class='ary_bt'><a href='#" . $proMenu_arti[ title ] . "'>" . $no . "、" . $proMenu_arti[ title ] . "</a></li>";
}
echo "</ul>";
echo "</li>";
}
echo "</ul>";
} else { //终极栏目文章列表
echo "<ul>";
$mesql_arti = $empire->query( "select * from {$dbtbpre}ecms_news where classid=" . $proMenu[ classid ] );
$no = 0;
while ( $proMenu_arti = $empire->fetch( $mesql_arti ) ) {
$titleurl = sys_ReturnBqTitleLink( $proMenu_arti ); //标题链接
$no++;
echo "<li class='active'><a href='#" . $proMenu_arti[ title ] . "'>" . $proMenu_arti[ title ] . "</a></li>";
}
echo "</ul>";
}
echo "</li>";
}
?>
</div>