欢迎光临 - 我的站长站,本站所有资源仅供学习与参考,禁止用于商业用途或从事违法行为!

帝国cms教程

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

帝国cms教程 我的站长站 2019-05-11 共1194人阅读

首先调用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 } ?>

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

相关推荐
  • 帝国cms二次开发
  • 下拉加载
  • 帝国CMS调用方法
  • 帝国CMS二次开发统计留言数量

    帝国CMS指定模型下的留言数量 代码:<?php$totalnum=(int)$_GET['totalnum']; $totalquery="select count(*) as total from ***_enewsgbook where bid=1 and chec

    帝国cms教程 240 10年前
  • 帝国cms二次开发怎样实现时间为:几小时前、几天前等格式

    放到:userfun.php <?ph ?>之间

    帝国cms教程 519 8年前
  • 帝国CMS二次开发解决内容关键字替换图片ALT办法

    对于帝国CMS的内容管理程序,个人站长朋友是没有什么说的了,安全又稳定,但再美好的东西也会有一点缺陷,对于内容关键字 图片ALT被替换实属让个人站长头疼的,最近在论坛上面找到了解决的办法,这样我们就可以解决这样的烦心事了! 这个办法是对KissVenus发的解...

    帝国cms教程 516 7年前
  • 帝国CMS二次开发织梦CMS数据转帝国CMS教程

    织梦CMS和帝国CMS哪种好?织梦dedecms是目前CMS开源系统中使用人数最多的CMS系统了,凭借着后台使用简单、模板制作也简单,网上模板素材、教程也非常多,受到大家的追捧。但用过织梦CMS都知道,织梦CMS有两个致命缺点:(1)织梦安全性差漏洞多,经常被黑客攻击,虽然官...

    帝国cms教程 533 5年前
  • 帝国CMS二次开发不开后台定时刷新脚本

    在你的操作系统,如果是linux的话,添加以下计划任务。 * * * * * /usr/bin/php /webrootpath/e/tasks/backend_cronjob.php。把代码传到 /e/tasks/ 下。 这个脚本将替代后台的定时刷新,你不用在开着后台了,它帮你定时刷新。适用场景:全战静态化,需要定时刷...

    帝国cms教程 366 7年前
  • dedecms ajax下拉搜索插件
    dedecms ajax下拉搜索插件

    织梦CMS下拉搜索插件效果图织梦CMS下拉搜索插件安装步骤1、打开你的网站首页模板,在</head>之前加入<script language="javascript" type="text/javascript" src="{dede:global.cfg_templets_skin...

    织梦cms插件 574 4年前
  • 帝国CMS二级联动插件(ajax下拉列表)
    帝国CMS二级联动插件(ajax下拉列表)

    帝国CMS二级联动插件(ajax下拉列表)效果: 使用方法: 将下拉外表关联字段的输入表单替换html代码和投稿表单替换为 <script src="/j...

    帝国cms插件 2217 9年前
  • 帝国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...

    帝国cms教程 1194 4年前
  • PHPCMS下拉加载插件
    PHPCMS下拉加载插件

    PHPCMS实现下拉加载的方法,兼容手机端主要思路是php+ajax+mysql的运用1 html代码部分<!--列表--><div id="lists"><!--本示例显示所有最新文章,根据实际情况自行调整-->{pc:get sql="SELECT * FR...

    phpcms模板 145 3年前
  • PHPCMS V9下拉加载插件[兼容手机端]
    PHPCMS V9下拉加载插件[兼容手机端]

    PHPCMS V9 实现下拉加载的方法,兼容手机端HTML部分<!--列表--><div id="lists"><!--本示例显示所有最新文章,根据实际情况自行调整-->{pc:get sql="SELECT * FROM `v9_news` where status=99 Ord...

    phpcms模板 150 3年前
  • 帝国CMS调用栏目自定义字段方法

    帝国CMS调用栏目自定义字段方法说明:封面模板,列表模板,内容模板都可以用,且调用方式都是一样的调用标签:<?=ReturnClassAddField(0,&#39;自定义字段&#39;)?>调用多个:<?=$value=ReturnClassAddField(1,&#39;自定义字段1,自定义字段2&#39;)?>取值:<?=$val...

    帝国cms教程 146 3年前
  • 帝国CMS新手教程调用栏目别名

    帝国CMS调用网站标题灵动标签调用网站标题:<?=$public_r[sitename]?> 帝国CMS标签调用网站标题:[!--pagetitle--] 帝国CMS调用栏目别名: <?=$class_r[$GLOBALS[navclas

    帝国cms教程 259 11年前
  • 帝国CMS调用网站标题的方法

    帝国CMS_调用网站标题的方法方法1: [!--pagetitle--]方法2:<?=$public_r[sitename]?>

    帝国cms教程 370 11年前
  • 帝国CMS灵动标签调用反馈信息

    语法:[e:loop={'select * from XX_enewsfeedback order by bid desc limit 10',8,24,0}]<li><a><?=$bqr[pinpai]?><?=$bqr[chexin]?></a><a><?=$bqr[title]?></a> (<?=fo

    帝国cms教程 231 11年前
  • 帝国CMS调用今日下载本月下载本周下载排行方法
    帝国CMS调用今日下载本月下载本周下载排行方法

    实现方法:第一步在数据表里添加三个字段:DayHits WeekHits MonthHits 分别设为字段类型为INT第二步打开文件:/e/public/ViewClick/index.php(//digg踩数后面添加如下代码...

    帝国cms教程 601 10年前