帝国cms灵动标签循环调用循环子栏目+信息
时间:2023年07月10日
/来源:网络
/编辑:佚名
代码一、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>
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>
新闻资讯 更多
- 【帝国cms教程】帝国CMS模板变量$GLOBALS[navclassid]用法分析04-03
- 【帝国cms教程】鲜为人知帝国CMS内容页调用上一篇和下一篇的精华方法汇总04-03
- 【帝国cms教程】怎么快速找出帝国CMS数据库配置文件路径及迁移网站后修改技巧!04-03
- 【帝国cms教程】帝国CMS模板$GLOBALS[navclassid]用法详解04-03
- 【帝国cms教程】帝国cms 7.5版列表页分页样式修改笔记04-02
- 【帝国cms教程】解决帝国CMS搜索页面模板不支持灵动标签和万能标签的方法04-02
- 【帝国cms教程】帝国CMS只备份栏目和模板的方法04-02
- 【帝国cms教程】帝国CMS怎样删除清空数据库记录?04-02
热门文章
- 178Moban源码谈谈免费源码与收费源码的区别
- 2帝国CMS忘记后台登陆用户名、密码、认证码的解决方法
- 3帝国CMS(EmpireCMS) v7.5后台任意代码执行漏洞及具体修复方法
- 4帝国CMS和WordPress 哪个好?哪个适合建站?
- 5如何解决Discuz的密码错误次数过多请15分钟后登陆的问题
- 6帝国cms灵动标签取得内容和栏目链接地址
- 7emlog pro 注册码“开心”教程(如果有一天,emlog官方版 或者 emlog免费版 跑路了,那用户怎么办?)
- 8织梦CMS在nginx下设置伪静态方法(附nginx伪静态规则)
- 9帝国cms后台登录出现”您还未登录”怎么解决?
- 10帝国cms7.5忘记登录密码 和忘记登录认证码以及多次登录 失败被锁定解决办法