Dedehtml.com

织梦dede:arclist分页使用教程和存在的BUG修复

摘要:织梦dede:arclist分页使用教程、修正dede:arclist分页数据库字段类型长度问题、修复只能获取10条数据问题

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 `#@__arcmulti` CHANGE `innertext` `innertext` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '';

GBK的织梦程序在后台-系统-SQL命令行工具,执行

ALTER TABLE `#@__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
	$addfieldsSql
	FROM `$maintable` arc LEFT JOIN `#@__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 `#@__arcmulti`;

修复结果

版权声明:本文为博主原创文章,未经博主允许不得转载。https://www.dedehtml.com/notes/dede-arcmulti.html
(5)
打赏 微信扫一扫 微信 支付宝 QQ 扫码打赏

DedeCMS织梦新手学习交流QQ群