Due to the effect requirements, dedecms needed to load more functions, and after a long time, it finally got it.
First, create a new list_case.php file below the/plus/file, with the following code:
<? php
/**
*
* Column list/Channel dynamic page
*
* @version $Id: list.php 1 15:38 July 8, 2010 Z tianya $
* @package DedeCMS.Site
* @copyright Copyright (c) 2007 – 2010, DesDev, Inc.
* @license http://help.dedecms.com/usersguide/license.html
* @link http://www.dedecms.com
*/
require_once(dirname(__FILE__).”/../ include/common.inc.php”);if(isset($_GET[‘ajax’])){
$typeid = isset($_GET[‘typeid’]) ? intval($_GET['typeid']): 0;//Passed classification ID
$page = isset($_GET[‘page’]) ? intval($_GET['page']): 0;//Page
$pagesize = isset($_GET[‘pagesize’]) ? intval($_GET['pagesize']): 15;//How many pieces per page, that is, how many pieces of data are loaded at a time
$start = $page>0 ? ($page-1)*$pagesize : 0;//starting position for data acquisition. This is the first parameter of the limit condition.
$typesql = $typeid ? "WHERE typeid=$typeid":";//This is used to implement waterfall loading on the home page, because the data loaded on the home page does not need to be classified, so it needs to be judged. If it is not necessary,
$total_sql = “SELECT COUNT(id) as num FROM `#@__archives` $typesql “;
$temp = $dsql->GetOne($total_sql);
$total = 0;//Total data
$load_num =0;
if(is_array($temp)){
$load_num= round(($temp['num']-15)/$pagesize);//the number of times to load, because it has already been loaded by default
$total = $temp[‘num’];
}
$sql = “SELECT a.*, t.typedir,t.typename,t.isdefault,t.defaultname,t.namerule,
t.namerule2,t.ispart, t.moresite,t.siteurl,t.sitepath
FROM `#@__archives` as a JOIN `#@__arctype` AS t ON a.typeid=t.id $typesql ORDER BY id DESC LIMIT $start,$pagesize”;
//echo “$sql”;
$dsql->SetQuery($sql);
$dsql->Execute(‘list’);
$statu = 0;//Whether there is data, no data by default
$data = array();
$index = 0;
while($row = $dsql->GetArray(“list”)){
$row[‘info’] = $row[‘info’] = $row[‘infos’] = cn_substr($row[‘description’],160);
$row[‘id’] = $row[‘id’];
$row[‘filename’] = $row[‘arcurl’] = GetFileUrl($row[‘id’],
$row[‘typeid’],$row[‘senddate’],$row[‘title’],$row[‘ismake’],
$row[‘arcrank’],$row[‘namerule’],$row[‘typedir’],$row[‘money’],
$row[‘filename’],$row[‘moresite’],$row[‘siteurl’],$row[‘sitepath’]);
$row[‘typeurl’] = GetTypeUrl($row[‘typeid’],$row[‘typedir’],
$row[‘isdefault’],$row[‘defaultname’],$row[‘ispart’],
$row[‘namerule2’],$row[‘moresite’],$row[‘siteurl’],$row[‘sitepath’]);
if($row[‘litpic’] == ‘-‘ || $row[‘litpic’] == ”){
$row[‘litpic’] = $GLOBALS[‘cfg_cmspath’].’/ images/defaultpic.gif’;
}
if(! preg_match(“#^http:\/\/#i”, $row[‘litpic’]) &&$GLOBALS[‘cfg_multi_site’] == ‘Y’){
$row[‘litpic’] = $GLOBALS[‘cfg_mainsite’].$ row[‘litpic’];
}
$row['picname'] = $row['litpic'];//Thumbnails
$row[‘stime’] = GetDateMK($row[‘pubdate’]);
$row[‘typelink’] = “<a href='”.$ row[‘typeurl’].”‘>”.$ row[‘typename’].”</a>";//Classification chain
$row['fulltitle'] = $row['title'];//Full title
$row['shorttitle'] = $row['shorttitle'];//Subtitle
$row['title'] = cn_substr($row['title'], 60);//intercepted title
$data[$index] = $row;
$index++;
}
if(! empty($data)){
$statu = 1;//data available
}
$result =array($data);
echo json_encode($result);//Returns data
exit();
}
/**
*
* Column list/Channel dynamic page
*
* @version $Id: list.php 1 15:38 July 8, 2010 Z tianya $
* @package DedeCMS.Site
* @copyright Copyright (c) 2007 – 2010, DesDev, Inc.
* @license http://help.dedecms.com/usersguide/license.html
* @link http://www.dedecms.com
*/
require_once(dirname(__FILE__).”/../ include/common.inc.php”);if(isset($_GET[‘ajax’])){
$typeid = isset($_GET[‘typeid’]) ? intval($_GET['typeid']): 0;//Passed classification ID
$page = isset($_GET[‘page’]) ? intval($_GET['page']): 0;//Page
$pagesize = isset($_GET[‘pagesize’]) ? intval($_GET['pagesize']): 15;//How many pieces per page, that is, how many pieces of data are loaded at a time
$start = $page>0 ? ($page-1)*$pagesize : 0;//starting position for data acquisition. This is the first parameter of the limit condition.
$typesql = $typeid ? "WHERE typeid=$typeid":";//This is used to implement waterfall loading on the home page, because the data loaded on the home page does not need to be classified, so it needs to be judged. If it is not necessary,
$total_sql = “SELECT COUNT(id) as num FROM `#@__archives` $typesql “;
$temp = $dsql->GetOne($total_sql);
$total = 0;//Total data
$load_num =0;
if(is_array($temp)){
$load_num= round(($temp['num']-15)/$pagesize);//the number of times to load, because it has already been loaded by default
$total = $temp[‘num’];
}
$sql = “SELECT a.*, t.typedir,t.typename,t.isdefault,t.defaultname,t.namerule,
t.namerule2,t.ispart, t.moresite,t.siteurl,t.sitepath
FROM `#@__archives` as a JOIN `#@__arctype` AS t ON a.typeid=t.id $typesql ORDER BY id DESC LIMIT $start,$pagesize”;
//echo “$sql”;
$dsql->SetQuery($sql);
$dsql->Execute(‘list’);
$statu = 0;//Whether there is data, no data by default
$data = array();
$index = 0;
while($row = $dsql->GetArray(“list”)){
$row[‘info’] = $row[‘info’] = $row[‘infos’] = cn_substr($row[‘description’],160);
$row[‘id’] = $row[‘id’];
$row[‘filename’] = $row[‘arcurl’] = GetFileUrl($row[‘id’],
$row[‘typeid’],$row[‘senddate’],$row[‘title’],$row[‘ismake’],
$row[‘arcrank’],$row[‘namerule’],$row[‘typedir’],$row[‘money’],
$row[‘filename’],$row[‘moresite’],$row[‘siteurl’],$row[‘sitepath’]);
$row[‘typeurl’] = GetTypeUrl($row[‘typeid’],$row[‘typedir’],
$row[‘isdefault’],$row[‘defaultname’],$row[‘ispart’],
$row[‘namerule2’],$row[‘moresite’],$row[‘siteurl’],$row[‘sitepath’]);
if($row[‘litpic’] == ‘-‘ || $row[‘litpic’] == ”){
$row[‘litpic’] = $GLOBALS[‘cfg_cmspath’].’/ images/defaultpic.gif’;
}
if(! preg_match(“#^http:\/\/#i”, $row[‘litpic’]) &&$GLOBALS[‘cfg_multi_site’] == ‘Y’){
$row[‘litpic’] = $GLOBALS[‘cfg_mainsite’].$ row[‘litpic’];
}
$row['picname'] = $row['litpic'];//Thumbnails
$row[‘stime’] = GetDateMK($row[‘pubdate’]);
$row[‘typelink’] = “<a href='”.$ row[‘typeurl’].”‘>”.$ row[‘typename’].”</a>";//Classification chain
$row['fulltitle'] = $row['title'];//Full title
$row['shorttitle'] = $row['shorttitle'];//Subtitle
$row['title'] = cn_substr($row['title'], 60);//intercepted title
$data[$index] = $row;
$index++;
}
if(! empty($data)){
$statu = 1;//data available
}
$result =array($data);
echo json_encode($result);//Returns data
exit();
}
Post ajax code on the page you need to display
<div class=”remodal” data-remodal-id=”modal”>
<ul id=”caseLi”>
{dede:arclist typeid=’5′ pagesize=’10’}
<li><a href=”[field:arcurl/]”><img src=”[field:litpic/]” alt=”[field:title/]” height=”500″ /></a></li>
{/dede:arclist}</ul>
<button id="loadMore" style="clear:both;width:80px; height:30px; border:none; background:#c2272b;line-height:30px; color:#fff; margin-top:20px;"> Load more</button>
</div>
<script type=”text/javascript”>
var clickNum = 1;
$(“#loadMore”).click(function(){
clickNum +=1;
$.ajax({
url:’/plus/list_case.php’,
data:{typeid:5,page:clickNum,pagesize:10,ajax:’pullcase’},
dataType:’json’,
success:function(data){
$.each(data[0],function(idx,item){
$(“#caseLi”).append(‘<li><a href=”‘+item.arcurl+'”><img src=”‘+item.picname+'” alt=”‘+item.title+'” height=”500″ /></a></li>’);
});
}
});
});</script> It is feasible after testing by bloggers. If there are bloggers who don't understand, you can reply below and I will see the answer.
<ul id=”caseLi”>
{dede:arclist typeid=’5′ pagesize=’10’}
<li><a href=”[field:arcurl/]”><img src=”[field:litpic/]” alt=”[field:title/]” height=”500″ /></a></li>
{/dede:arclist}</ul>
<button id="loadMore" style="clear:both;width:80px; height:30px; border:none; background:#c2272b;line-height:30px; color:#fff; margin-top:20px;"> Load more</button>
</div>
<script type=”text/javascript”>
var clickNum = 1;
$(“#loadMore”).click(function(){
clickNum +=1;
$.ajax({
url:’/plus/list_case.php’,
data:{typeid:5,page:clickNum,pagesize:10,ajax:’pullcase’},
dataType:’json’,
success:function(data){
$.each(data[0],function(idx,item){
$(“#caseLi”).append(‘<li><a href=”‘+item.arcurl+'”><img src=”‘+item.picname+'” alt=”‘+item.title+'” height=”500″ /></a></li>’);
});
}
});
});</script> It is feasible after testing by bloggers. If there are bloggers who don't understand, you can reply below and I will see the answer.