DEDECMS列表页只要上一页下一页纯URL的完美处理方式
因为做手机要做自动加载更多,AJAX技术需要用到列表页的下一页链接URL,网上这方面的资料确实比较少,现在把正确能调用出结果的方法公布出来,希望大家能少走弯路!其实很简单,就几点!以红色字体的操作为准!做下来之后调用结果就显示了!
因为我们只要调用出地址就好了,其它的路径我们最好在模板上加,不要随便在PHP页面加,这方便多站点好管理!
当然,像www.qilatu.com/tag.html?广州SEO 这种伪静态列表我们也是同样的道理的,主要修改文件是:/include/arc.taglist.class.php 这个文件,在这里自定义的变量可能用不了,可以用next输出,修改对应代码即可! {dede:pagelist listitem="index,pageno,end," listsize="5"/} 后面输出列表样式!
效果: <link rel='next' href=' http://www.qilatu.com{dede:type }[field:typelink /]{/dede:type}{dede:pagelist listitem=downpage /}' />
我们就可以得出
http://www.qilatu.com/html/xxxx/list_2_2.html
模板中以
复制代码代码如下:
{dede:pagelist listitem=up/}
{dede:pagelist listitem=down/}
来调用。
在include\arc.listview.class.php
找到:
/**
* 获取静态的分页列表
*
* @access public
* @param string $list_len 列表宽度
* @param string $list_len 列表样式
* @return string
*/
function GetPageListST($list_len,$listitem="index,end,pre,next,pageno")
{
$prepage = $nextpage = '';
$prepagenum = $this->PageNo-1;
$nextpagenum = $this->PageNo+1;
if($list_len=='' || preg_match("/[^0-9]/", $list_len))
{
$list_len=3;
}
$totalpage = ceil($this->TotalResult/$this->PageSize);
if($totalpage<=1 && $this->TotalResult>0)
{
//return "<li><span >共 <strong>1</strong>页<strong></li>";
// return "<li><span class=\"pageinfo\">共 <strong>1</strong>页<strong>".$this->TotalResult."</strong>条记录</span></li>\r\n";
}
if($this->TotalResult == 0)
{
//return "<li><span class=\"pageinfo\">共 <strong>0</strong>页<strong>".$this->TotalResult."</strong>条记录</span></li>\r\n";
}
$purl = $this->GetCurUrl();
// $maininfo = "<li><span class=\"pageinfo\">共 <strong>{$totalpage}</strong>页<strong>".$this->TotalResult."</strong>条</span></li>\r\n";
$tnamerule = $this->GetMakeFileRule($this->Fields['id'],"list",$this->Fields['typedir'],$this->Fields['defaultname'],$this->Fields['namerule2']);
$tnamerule = preg_replace("/^(.*)\//", '', $tnamerule);
//获得上一页和主页的链接
if($this->PageNo != 1){
$prepage.="<li>上一页</li>";
$indexpage="<li>首页</li>";
$uppage.=str_replace("{page}",$prepagenum,$tnamerule); //加上对应的代码
}
else
{
$indexpage="<li>首页</li>";
$uppage.="<a>第一页</a>";
}
//下一页,未页的链接
if($this->PageNo!=$totalpage && $totalpage>1)
{
$nextpage.="<li><a href='".str_replace("{page}",$nextpagenum,$tnamerule)."'>下一页</a></li>";
$endpage="<li><a href='".str_replace("{page}",$totalpage,$tnamerule)."'>末页</a></li>";
$downpage.=str_replace("{page}",$nextpagenum,$tnamerule); //加上对应的代码
}
else
{
$endpage="<li>末页<li>";
//$downpage.="<a>最后一页</a>";
}
复制代码代码如下:$plist = '';
if(preg_match('/up/i', $listitem)) $plist .= $uppage; //加上对应的代码
if(preg_match('/down/i', $listitem)) $plist .= $downpage; //加上对应的代码
if(preg_match('/index/i', $listitem)) $plist .= $indexpage;
if(preg_match('/pre/i', $listitem)) $plist .= $prepage;
if(preg_match('/pageno/i', $listitem)) $plist .= $listdd;
if(preg_match('/next/i', $listitem)) $plist .= $nextpage;
if(preg_match('/end/i', $listitem)) $plist .= $endpage;
if(preg_match('/option/i', $listitem)) $plist .= $optionlist;
if(preg_match('/info/i', $listitem)) $plist .= $maininfo;
原创文章,转载请注明: 转载自广州SEO
本文链接地址: DEDECMS列表页只要上一页下一页纯URL的完美处理方式
全是直道 半天看不到别的车 其实没想象中那么危险
晨曦白露上江楼, 千里楚乡正素秋。
再苦不能哭政府,再穷不能穷官员
赶紧来蹭一下,哇咔咔!
哇,好高大上!
这个更刺j激,准备好手纸哦 A 片。。 http://T.CN/Rca9M0K
我们这有家秦宝成口腔诊所 价格简直便宜到爆。正规牙科诊所。
最爱明蓝!唐缘和明静到底有什么过节呢?
后面的人好淡定啊
博客中五毛不少。
能有beyond日记就好了,在网上下了好长一段时间都只下了1/3 ^_^
朝鲜半岛···
Model Quos...I’d need to examine with you here. Which isn't one thing I often do! I enjoy reading a submit that can make folks
弗兰肯斯坦既视感
没有了大陆,地球照样转,台湾还是台湾,大陆还是穷光蛋各地区争取台湾人前来投资的时候,台湾就发展起来啦!已经是四小龙啦,如今大陆一朝发展起来有钱得志得意啦,忘恩忘本忘形,置那些去台资企业打工维持生计的劳动人民于不顾,拿大陆的市场,廉价劳动力,资源来耍横,不
快更新吧!???