帝国cms通过自定义列表分页显示留言板
2022-01-23 08:25:58
帝国cms可以通过/e/tool/gbook/?bid=1来显示留言板内容
本文的目的是通过自定义列表来显示留言前台内容,步骤如下:
1、新建如下自定义列表
统计记录: select count(*) as total from [!db.pre!]enewsgbook where bid=1 and checked=0 and retext!=""
上述语句中必须要有as total,固定格式
查询记录:select lytext as title,lyid as classid,lyid as id,lyid as ftitle,lyid as titleurl,lyid as titlepic,retext as smalltext,lyid as onclick,lyid as newstime from [!db.pre!]enewsgbook where bid=1 and checked=0 and retext!="" order by lyid desc
2、使用列表模板:
[!--empirenews.listtemp--]
<ul class="list37">
<!--list.var1-->
<!--list.var2-->
<!--list.var3-->
<!--list.var4-->
<!--list.var5-->
</ul>
[!--empirenews.listtemp--]
[!--show.listpage--]
列表内容模板(list.var) (*)
$listtemp=' <li>
<div class="list37-1">'.$r[title].'<span><img src="/images/givelike.png"><span>'.$r[likecount].'</span></span></div>
<div class="list37-2">'.$r[retext].'</div>
</li>';
留言成功后自动跳转还会到/e/tool/gbook/?bid=1文件,解决办法修改 公共模板管理-》留言板模板
<?php
header('Location: /a/lyb/');
?>
重新生成模版后,如果是全站禁止允许动态脚本的话还需要修改\e\tool\gbook\index.php文件首行添加define('EmpireCMSAdmin','1');来允许运行脚本
分页函数listpage修改地方为:\e\class\t_functions.php中的sys_ShowListPage函数
//列表模板分页函数
function sys_ShowListPage($num,$pagenum,$dolink,$dotype,$page,$lencord,$ok,$search="",$add)
本文的目的是通过自定义列表来显示留言前台内容,步骤如下:
1、新建如下自定义列表
统计记录: select count(*) as total from [!db.pre!]enewsgbook where bid=1 and checked=0 and retext!=""
上述语句中必须要有as total,固定格式
查询记录:select lytext as title,lyid as classid,lyid as id,lyid as ftitle,lyid as titleurl,lyid as titlepic,retext as smalltext,lyid as onclick,lyid as newstime from [!db.pre!]enewsgbook where bid=1 and checked=0 and retext!="" order by lyid desc
2、使用列表模板:
[!--empirenews.listtemp--]
<ul class="list37">
<!--list.var1-->
<!--list.var2-->
<!--list.var3-->
<!--list.var4-->
<!--list.var5-->
</ul>
[!--empirenews.listtemp--]
[!--show.listpage--]
列表内容模板(list.var) (*)
$listtemp=' <li>
<div class="list37-1">'.$r[title].'<span><img src="/images/givelike.png"><span>'.$r[likecount].'</span></span></div>
<div class="list37-2">'.$r[retext].'</div>
</li>';
留言成功后自动跳转还会到/e/tool/gbook/?bid=1文件,解决办法修改 公共模板管理-》留言板模板
<?php
header('Location: /a/lyb/');
?>
重新生成模版后,如果是全站禁止允许动态脚本的话还需要修改\e\tool\gbook\index.php文件首行添加define('EmpireCMSAdmin','1');来允许运行脚本
分页函数listpage修改地方为:\e\class\t_functions.php中的sys_ShowListPage函数
//列表模板分页函数
function sys_ShowListPage($num,$pagenum,$dolink,$dotype,$page,$lencord,$ok,$search="",$add)