本文目录一览:
- 1、dedecms列表实现点击加载更多列表,求高手解答
- 2、dedecms如何修改配置文件使点击量增加200
- 3、织梦首页如何实现点击加载更多
- 4、dedecms首页 点击加载更多 怎么实现
- 5、dedecms 列表点击加载更多读取数据库内容怎么实现
dedecms列表实现点击加载更多列表,求高手解答
用ajax读取下一页内容,然后显示到当前页面
在模板页面/head之前加以下内容
script type="text/javascript" src="{dede:global.cfg_cmsurl/}/include/dedeajax2.js"/script
script language="javascript" 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("/plus/arcmulti.php?mtype=0pnum="+pagenum+'tagid='+tagid);
myajax = new DedeAjax(taget_obj_page,false,false,'','','');
myajax.SendGet2("/plus/arcmulti.php?mtype=1pnum="+pagenum+'tagid='+tagid);
DedeXHTTP = null;
return false;
}
/script
在模板页面 列表代码
{dede:arclist typeid="1,2,3" tagid='anynews' pagesize='30' row='10000'}
li a href='[field:arcurl/]' target='_blank'
span class='preview'img src="[field:litpic/]" alt="[field:title/]"//spanspan class="title"[field:title/]/span
/a/li
{/dede:arclist}
在模板页面列表容器之后加分页代码
div class="dede_pages"
ul class="pagelist"
{dede:arcpagelist tagid='anynews'/}
/ul
/div
修改完保存即可。用此办法可以在当前页不刷新显示下一页内容。如果希望点击下一页后新显示的内容添加到旧内容后面,那么需要修改/include/dedeajax2.js文件104行
DedeContainer.innerHTML = DedeXHTTP.responseText;
改成
DedeContainer.innerHTML += DedeXHTTP.responseText;
dedecms如何修改配置文件使点击量增加200
1,织梦后台, 系统有这个设置,但是是默认变量而已。
2,发布文档的时候手动填写也是可以的
3,要修改默认变量,需要修改相应程序文件,这个暂时无法一句话回答
梦客吧织梦模板
为您解答
望采纳
织梦首页如何实现点击加载更多
这个属于瀑布流特效,需要用到js。代码太长这里粘贴不下,建议你搜“瀑布流特效”“无限加载特效”“点击加载更多特效”,有现成的例子。
dedecms首页 点击加载更多 怎么实现
使用方法:
1、加载是用AJAX,需要先引用jQuery
2、模板在arcajax.php第二十八行请自行按需修改
3、arcajax.php放到plus目录下
HTML和js代码:
div id="loading27"加载中/div
a href="javascript:;" id="getMore" pnum="2" class="index-more bgw mt15"浏览更多案例....../a
script type="text/javascript"
$("#getMore").click(function(){
var _this = $(this),
pnum = _this.attr("pnum"),//分页码
typeid = 1;// 栏目ID
if(pnum == 0){
return false;
}
$("#loading27").show();
$.ajax({
url: '/plus/arcajax.php',
data: {typeid:typeid,pnum:pnum},
success: function(data){
if(data != ''){
$(".index-list").append(data);//数据显示到页面
_this.attr("pnum", Number(pnum)+1);//分页+1
}else{
_this.text("没有更多的数据");
_this.attr("pnum", 0)
}
$("#loading27").hide();
}
})
return false;
})
/script
PHP代码(arcajax.php):
?php
require_once(dirname(__FILE__)."/../include/common.inc.php");
require_once(DEDEINC.'/channelunit.class.php');
require_once(DEDEINC.'/taglib/arcpagelist.lib.php');
$pnum = empty($pnum)? 0 : intval(preg_replace("/[^\d]/",'', $pnum));
$typeid = empty($typeid)? 0 : intval(preg_replace("/[^\d]/",'', $typeid));
if($typeid==0 || $pnum==0) die(" Request Error! ");
if($typeid 0)
{
$titlelen = AttDef($titlelen,30);
$infolen = AttDef($infolen,160);
$imgwidth = AttDef($imgwidth,120);
$imgheight = AttDef($imgheight,120);
$listtype = AttDef($listtype,'all');
$arcid = AttDef($arcid,0);
$channelid = AttDef($channelid,0);
$orderby = AttDef($orderby,'default');
$orderWay = AttDef($order,'desc');
$subday = AttDef($subday,0);
$line = $row;
$artlist = '';
//通过页面及总数解析当前页面数据范围
$strnum = ($pnum-1) * 12;
$limitsql = " LIMIT $strnum,12 ";
$innertext = 'li [field:global name="autoindex" runphp="yes"]if(@me%3==0)@me=\'class="mrnone"\'; else @me="";[/field:global]
diva href="[field:arcurl/]" title="[field:title/]"img src="[field:litpic/]" /a/div
h3a href="[field:arcurl/]" title="[field:title/]"[field:title/]/a/h3
p[field:description function="cn_substr(@me,150)"/]/p
span class="more"a href="[field:arcurl/]"浏览案例/a/span
/li';//模板
//处理列表内容项
$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 FROM `dede_archives` arc LEFT JOIN `dede_arctype` tp ON arc.typeid=tp.id
WHERE arc.typeid IN (".GetSonIds($typeid).") ORDER BY arc.sortrank desc $limitsql";
$dsql-SetQuery($query);
$dsql-Execute('al');
$dtp2 = new DedeTagParse();
$dtp2-SetNameSpace('field', '[', ']');
$dtp2-LoadString($innertext);
$GLOBALS['autoindex'] = 0;
$ids = array();
dedecms 列表点击加载更多读取数据库内容怎么实现
使用方法:
1、加载是用AJAX,需要先引用jQuery
2、模板在arcajax.php第二十八行请自行按需修改
3、arcajax.php放到plus目录下
HTML和js代码:
div id="loading27"加载中/div
a href="javascript:;" id="getMore" pnum="2" class="index-more bgw mt15"浏览更多案例....../a
script type="text/javascript"
$("#getMore").click(function(){
var _this = $(this),
pnum = _this.attr("pnum"),//分页码
typeid = 1;// 栏目ID
if(pnum == 0){
return false;
}
$("#loading27").show();
$.ajax({
url: '/plus/arcajax.php',
data: {typeid:typeid,pnum:pnum},
success: function(data){
if(data != ''){
$(".index-list").append(data);//数据显示到页面
_this.attr("pnum", Number(pnum)+1);//分页+1
}else{
_this.text("没有更多的数据");
_this.attr("pnum", 0)
}
$("#loading27").hide();
}
})
return false;
})
/script
PHP代码(arcajax.php):
?php
require_once(dirname(__FILE__)."/../include/common.inc.php");
require_once(DEDEINC.'/channelunit.class.php');
require_once(DEDEINC.'/taglib/arcpagelist.lib.php');
$pnum = empty($pnum)? 0 : intval(preg_replace("/[^\d]/",'', $pnum));
$typeid = empty($typeid)? 0 : intval(preg_replace("/[^\d]/",'', $typeid));
if($typeid==0 || $pnum==0) die(" Request Error! ");
if($typeid 0)
{
$titlelen = AttDef($titlelen,30);
$infolen = AttDef($infolen,160);
$imgwidth = AttDef($imgwidth,120);
$imgheight = AttDef($imgheight,120);
$listtype = AttDef($listtype,'all');
$arcid = AttDef($arcid,0);
$channelid = AttDef($channelid,0);
$orderby = AttDef($orderby,'default');
$orderWay = AttDef($order,'desc');
$subday = AttDef($subday,0);
$line = $row;
$artlist = '';
//通过页面及总数解析当前页面数据范围
$strnum = ($pnum-1) * 12;
$limitsql = " LIMIT $strnum,12 ";
$innertext = 'li [field:global name="autoindex" runphp="yes"]if(@me%3==0)@me=\'class="mrnone"\'; else @me="";[/field:global]
diva href="[field:arcurl/]" title="[field:title/]"img src="[field:litpic/]" width="278" height="245"/a/div
h3a href="[field:arcurl/]" title="[field:title/]"[field:title/]/a/h3
p[field:description function="cn_substr(@me,150)"/]/p
span class="more"a href="[field:arcurl/]"浏览案例/a/span
/li';//模板
//处理列表内容项
$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 FROM `dede_archives` arc LEFT JOIN `dede_arctype` tp ON arc.typeid=tp.id
WHERE arc.typeid IN (".GetSonIds($typeid).") ORDER BY arc.sortrank desc $limitsql";
$dsql-SetQuery($query);
$dsql-Execute('al');
$dtp2 = new DedeTagParse();
$dtp2-SetNameSpace('field', '[', ']');
$dtp2-LoadString($innertext);
$GLOBALS['autoindex'] = 0;
$ids = array();
for($i=0; $i12; $i++)
{
for($j=0; $j1; $j++)
{
if($row = $dsql-GetArray("al"))
{
$ids[] = $row['id'];
//处理一些特殊字段
$row['info'] = $row['infos'] = cn_substr($row['description'],$infolen);
$row['id'] = $row['id'];
if($row['corank'] 0 $row['arcrank']==0)
{
$row['arcrank'] = $row['corank'];
}
$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:\/\/#", $row['litpic']) $GLOBALS['cfg_multi_site'] == 'Y')
{
$row['litpic'] = $GLOBALS['cfg_mainsite'].$row['litpic'];
}
$row['picname'] = $row['litpic'];
$row['stime'] = GetDateMK($row['pubdate']);
$row['typelink'] = "a href='".$row['typeurl']."'".$row['typename']."/a";
$row['image'] = "img src="".$row["picname']."' border='0' width='$imgwidth' height='$imgheight' alt="".preg_replace("#[']#", "", $row['title'])."'";
$row['imglink'] = "a href='".$row['filename']."'".$row['image']."/a";
$row['fulltitle'] = $row['title'];
$row['title'] = cn_substr($row['title'],$titlelen);
if($row['color']!='') $row['title'] = "font color='".$row['color']."'".$row['title']."/font";
if(preg_match('#b#', $row['flag'])) $row['title'] = "strong".$row['title']."/strong";
//$row['title'] = "b".$row['title']."/b";
$row['textlink'] = "a href='".$row['filename']."'".$row['title']."/a";
$row['plusurl'] = $row['phpurl'] = $GLOBALS['cfg_phpurl'];
$row['memberurl'] = $GLOBALS['cfg_memberurl'];
$row['templeturl'] = $GLOBALS['cfg_templeturl'];
if(is_array($dtp2-CTags))
{
foreach($dtp2-CTags as $k=$ctag)
{
if($ctag-GetName()=='array')
{
//传递整个数组,在runphp模式中有特殊作用
$dtp2-Assign($k,$row);
} else {
if(isset($row[$ctag-GetName()])) $dtp2-Assign($k,$row[$ctag-GetName()]);
else $dtp2-Assign($k,'');
}
}
$GLOBALS['autoindex']++;
}
$artlist .= $dtp2-GetResult()."\r\n";
}//if hasRow
else {
$artlist .= '';
}
}//Loop Col
}//loop line
$dsql-FreeResult("al");
} else
{
die(" Request Error! ");
}
AjaxHead();
echo $artlist;
exit();