帝国CMS二次开发下拉加载更多教程

首先调用20条默认的信息,代码如下

<section class=FConBig>
	<div class=divcon>
		<div id=divcon1>
[e:loop={select * from www_11px_cn_ecms_news where classid in (2,3,4,5,6) order by newstime desc limit 20,6,24,0}]
			<dl class=FConSmall>
			  <dt><a href=<?=$bqsr['titleurl']?>><img src=<?=$public_r['add_www_11px_cn_url']?><?=$bqr['titlepic']?> width=100%></a></dt>
			  <dd> <a href=<?=$bqsr['titleurl']?> class=FConWza> <span class=FConWzTag><?=$bqsr[classname]?></span> <span class=FConTimeIco></span> <span class=FConWzTime><?=date('Y-m-d',$bqr[newstime])?></span> </a> <a href=<?=$bqsr['titleurl']?> class=FConWzDesc><?=$bqr['title']?></a> </dd>
			</dl>
[/e:loop]
		</div>
	</div>
  </section>

  <div class=FConBig id=paiList></div>
  <div id=divcon2><div id=divload></div></div>

然后再是下拉加载的JS代码,

<script src=/Style/js/jquery-1.7.1.min.js></script>
<script language=javascript type=text/javascript>
$(document).ready(function(){
	var page = 1;//这个不是真正的页数,而是位移量
	var nextpage = 1;
	
	var wan=true;
	var totalheight = 0;   
    function loadData(){   
	totalheight = parseFloat($(window).height()) + parseFloat($(window).scrollTop());  
	 if ($(document).height() <= totalheight && wan==true) {  // 说明滚动条已达底部  
		var cid = 0;
		page = nextpage;
		$.ajax({
			url : '/Style/getajax.php',
			type:'get',
			data:{classid:cid,'next':page},
			dataType : 'html',
			beforeSend:function(){
				$('#divload').html('<div id=pullUp><p class=pullUpLabela><img src=/Style/css/img/wait1.gif width=20><span>正在载入</span></p></div>');
				$('#divcon2').show();
				wan=false;
			},
			success : function(str){
				if(str!=){
					$('#divcon1').show();
					$('#divcon2').hide();
					$('#divcon1').append(str);
					nextpage++;
					wan=true;
				}else{
					$('#divload').html('<div id=pullUp> <span class=pullUpLabel>加载完毕!</span></div>');
					$('#divcon2').show();
				}
			}
		});
	}}
	  $(window).scroll( function() {   
            loadData();  

        });   
})
</script>

最后就是getAJAX.php的加载代码

<?php
$ye=strFilter($_GET[next]);
$clasid=strFilter($_GET[classid]);

if($clasid==1){$clasid=2,3,4,5,6;}
if($clasid==7){$clasid=8,9,10,11,12,13;}
if($clasid==14){$clasid=15,16,17;}
if($clasid==18){$clasid=19,20,21,22;}
if($clasid==23){$clasid=24,25,26,27,38;}
if($clasid==28){$clasid=29,30,31,32;}
if($clasid==33){$clasid=34,35,36,37;}
if($clasid==0){
$aabbccdd = base64_encode(select * from www_11px_cn_ecms_news order by newstime desc limit);
}else{
$aabbccdd = base64_encode(select * from www_11px_cn_ecms_news where classid in ($clasid) order by newstime desc limit);
}
function strFilter($str){
    $str = str_replace('`', '', $str);
    $str = str_replace('·', '', $str);
    $str = str_replace('~', '', $str);
    $str = str_replace('!', '', $str);
    $str = str_replace('!', '', $str);
    $str = str_replace('@', '', $str);
    $str = str_replace('#', '', $str);
    $str = str_replace('$', '', $str);
    $str = str_replace('¥', '', $str);
    $str = str_replace('%', '', $str);
    $str = str_replace('^', '', $str);
    $str = str_replace('……', '', $str);
    $str = str_replace('&', '', $str);
    $str = str_replace('*', '', $str);
    $str = str_replace('(', '', $str);
    $str = str_replace(')', '', $str);
    $str = str_replace('(', '', $str);
    $str = str_replace(')', '', $str);
    $str = str_replace('-', '', $str);
    $str = str_replace('_', '', $str);
    $str = str_replace('——', '', $str);
    $str = str_replace('+', '', $str);
    $str = str_replace('=', '', $str);
    $str = str_replace('|', '', $str);
    $str = str_replace('', '', $str);
    $str = str_replace('[', '', $str);
    $str = str_replace(']', '', $str);
    $str = str_replace('【', '', $str);
    $str = str_replace('】', '', $str);
    $str = str_replace('{', '', $str);
    $str = str_replace('}', '', $str);
    $str = str_replace(';', '', $str);
    $str = str_replace(';', '', $str);
    $str = str_replace(':', '', $str);
    $str = str_replace(':', '', $str);
    $str = str_replace(''', '', $str);
    $str = str_replace('', '', $str);
    $str = str_replace('“', '', $str);
    $str = str_replace('”', '', $str);
    $str = str_replace(',', '', $str);
    $str = str_replace(',', '', $str);
    $str = str_replace('<', '', $str);
    $str = str_replace('>', '', $str);
    $str = str_replace('《', '', $str);
    $str = str_replace('》', '', $str);
    $str = str_replace('.', '', $str);
    $str = str_replace('。', '', $str);
    $str = str_replace('/', '', $str);
    $str = str_replace('、', '', $str);
    $str = str_replace('?', '', $str);
    $str = str_replace('?', '', $str);
    return trim($str);
}
require(../e/class/connect.php); 
if(!defined('InEmpireCMS')) 
{ 
exit(); 
} 
require(../e/class/db_sql.php); 
require(../e/class/q_functions.php); 
$link=db_connect(); 
$empire=new mysqlquery(); 

$yema= $ye*20;
$query = @mysql_query(base64_decode($aabbccdd). $yema,20) //执行SQL语句 
or die(SQL语句执行失败2); 
while($rs = mysql_fetch_assoc($query)){
$src  = $rs[id];
$xwclassid=$rs['classid'];
$xwtitle=$rs['title'];
$xwtitleurl=$rs['titleurl'];
$xwtitlepic=$rs['titlepic'];
$smalltext=$rs['smalltext'];
$newstime=$rs['newstime'];
$onclick=$rs['onclick'];
$tuurl=$public_r[add_www_11px_cn_url];

$queryss = @mysql_query(select * from www_11px_cn_enewsclass where classid='$xwclassid') //执行SQL语句 
or die(SQL语句执行失败3); 
while($rstt = mysql_fetch_assoc($queryss)){$xwclassname=$rstt[classname];$xwclasspath=$rstt[classpath];}

?>
    <dl class=FConSmall>
      <dt><a href=<?=$xwtitleurl?>><img src=<?=$tuurl?><?=$xwtitlepic?> width=100%></a></dt>
      <dd> <a href=<?=$xwtitleurl?> class=FConWza> <span class=FConWzTag><?=$xwclassname?></span> <span class=FConTimeIco></span> <span class=FConWzTime><?=date('Y-m-d',$newstime)?></span> </a> <a href=<?=$xwtitleurl?> class=FConWzDesc><?=$xwtitle?></a> </dd>
    </dl>
<?php } ?>

这段代码加了写判断栏目的功能,大家按格式自行修改吧。

1. 本站所有资源来源于用户上传和网络,如有侵权请邮件联系站长!
2. 分享目的仅供大家学习和交流,您必须在下载后24小时内删除!
3. 不得使用于非法商业用途,不得违反国家法律。否则后果自负!
4. 本站提供的源码、模板、插件等等其他资源,都不包含技术服务请大家谅解!
5. 如有链接无法下载、失效或广告,请联系管理员处理!
6. 本站资源售价只是赞助,收取费用仅维持本站的日常运营所需!
7. 如遇到加密压缩包,请使用WINRAR解压,如遇到无法解压的请联系管理员!
8. 精力有限,不少源码未能详细测试(解密),不能分辨部分源码是病毒还是误报,所以没有进行任何修改,大家使用前请进行甄别
9.本站默认解压密码为:www.sudo1.com
本站提供的一切软件、教程和内容信息仅限用于学习和研究目的。
不得将上述内容用于商业或者非法用途,否则,一切后果请用户自负。
本站信息来自网络收集整理,版权争议与本站无关。您必须在下载后的24个小时之内,从您的电脑或手机中彻底删除上述内容。
如果您喜欢该程序和内容,请支持正版,购买注册,得到更好的正版服务。
我们非常重视版权问题,如有侵权请邮件与我们联系处理。敬请谅解!

云资源网 » 帝国CMS二次开发下拉加载更多教程

常见问题FAQ

免费下载或者VIP会员专享资源能否直接商用?
本站所有资源版权均属于原作者所有,这里所提供资源均只能用于参考学习用,请勿直接商用。若由于商用引起版权纠纷,一切责任均由使用者承担。更多说明请参考 VIP介绍。
提示下载完但解压或打开不了?
最常见的情况是下载不完整: 可对比下载完压缩包的与网盘上的容量,若小于网盘提示的容量则是这个原因。这是浏览器下载的bug,建议用百度网盘软件或迅雷下载。 若排除这种情况,可在对应资源底部留言,或 联络我们.。
你们有qq群吗怎么加入?
当然有的,如果你是帝国cms、易优cms、和pbootcms系统的爱好者你可以加入我们的QQ千人交流群https://www.sudo1.com/page-qun.html。
  • 会员数(个)
  • 12310资源数(个)
  •        
  • 资源(G)
  •        
  • 今日下载
  • 1505稳定运行(天)

提供最优质的资源集合

立即查看 了解详情