- dede:arclist分页使用教程
1、引入js部分,而且要确保这2个文件存在 /include/dedeajax2.js 和 /plus/arcmulti.php
<script type="text/javascript" src="{dede:global.cfg_cmspath/}/include/dedeajax2.js"></script><script type="text/javascript">function multi(pagenum,tagid){var taget_obj = document.getElementById(tagid);var taget_obj_page = document.getElementById("page_"+tagid);myajax = new DedeAjax(taget_obj,false,false,'','','');myajax.SendGet2("{dede:global.cfg_cmspath/}/plus/arcmulti.php?mtype=0&pnum="+pagenum+'&tagid='+tagid);myajax = new DedeAjax(taget_obj_page,false,false,'','','');myajax.SendGet2("{dede:global.cfg_cmspath/}/plus/arcmulti.php?mtype=1&pnum="+pagenum+'&tagid='+tagid);DedeXHTTP = null;}</script>
2、数据列表标签 和 分页标签
<dl><dd><ul class="d1 ico3">{dede:arclist titlelen='250' pagesize='5' tagid='myindex'}<li><span>[field:pubdate function="MyDate('m-d',@me)"/]</span><a href="[field:arcurl /]">[field:title /]</a></li>{/dede:arclist}</ul></dd></dl><div class="page">{dede:arcpagelist tagid='myindex'/}</div>
{dede:arclist titlelen='250' pagesize='5' tagid='myindex'}
{dede:arcpagelist tagid='myindex'/}
标色地方是必须要的,而且tagid要统一
效果
dede:arclist分页存在BUG修复
1、修正数据库字段类型长度问题,不然{dede:arclist}中间部分代码过长会被截断{/dede:arclist}
UTF-8的织梦程序在后台-系统-SQL命令行工具,执行
ALTER TABLE `dede_arcmulti` CHANGE `innertext` `innertext` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '';
GBK的织梦程序在后台-系统-SQL命令行工具,执行
ALTER TABLE `dede_arcmulti` CHANGE `innertext` `innertext` TEXT CHARACTER SET gbk COLLATE gbk_chinese_ci NOT NULL DEFAULT '';
2、修复只能获取10条数据问题
打开 /include/taglib/arclist.lib.php 找到
$idsstr = join(',', $ids);
在它下面加入
//arclist分页BUG修复$query = "SELECT arc.*,tp.typedir,tp.typename,tp.corank,tp.isdefault,tp.defaultname,tp.namerule,tp.namerule2,tp.ispart,tp.moresite,tp.siteurl,tp.sitepath$addfieldsSqlFROM `$maintable` arc LEFT JOIN `dede_arctype` tp on arc.typeid=tp.id$addfieldsSqlJoin$orwhere $ordersql";$dsql->SetQuery($query);$dsql->Execute('tag');while($row = $dsql->GetArray('tag')) {$tagids[] = $row['id'];}$idsstr = join(',', $tagids);//arclist分页BUG修复
最后还需要在后台-系统-SQL命令行工具,执行
TRUNCATE `dede_arcmulti`;
结果