87,921
社区成员
发帖
与我相关
我的任务
分享
//获取分页导航列表
function GetPageList($atts,$refObj='',$fields=array())
{
global $lang_pre_page,$lang_next_page,$lang_index_page,$lang_end_page,$lang_record_number,$lang_page,$lang_total;
$prepage = $nextpage = $geturl= $hidenform = '';
$purl = $this->GetCurUrl();
$prepagenum = $this->pageNO-1;
$nextpagenum = $this->pageNO+1;
if(!isset($atts['listsize']) || preg_match("#[^0-9]#", $atts['listsize']))
{
$atts['listsize'] = 5;
}
if(!isset($atts['listitem']))
{
$atts['listitem'] = "info,index,end,pre,next,pageno";
}
$totalpage = ceil($this->totalResult/$this->pageSize);
//echo " {$totalpage}=={$this->totalResult}=={$this->pageSize}";
//无结果或只有一页的情况
if($totalpage<=1 && $this->totalResult > 0)
{
return "<span>{$lang_total} 1 {$lang_page}/".$this->totalResult.$lang_record_number."</span>";
}
if($this->totalResult == 0)
{
return "<span>{$lang_total} 0 {$lang_page}/".$this->totalResult.$lang_record_number."</span>";
}
$infos = "<span>{$lang_total} {$totalpage} {$lang_page}/{$this->totalResult}{$lang_record_number} </span>";
if($this->totalResult!=0)
{
$this->getValues['totalresult'] = $this->totalResult;
}
if(count($this->getValues)>0)
{
foreach($this->getValues as $key=>$value)
{
$value = urlencode($value);
$geturl .= "$key=$value"."&";
$hidenform .= "<input type='hidden' name='$key' value='$value' />\n";
}
}
$purl .= "page-".$this->totalResult."&";
//获得上一页和下一页的链接
if($this->pageNO != 1)
{
$prepage .= "<a class='prePage' href='".$purl."$prepagenum'>$lang_pre_page</a> \n";
$indexpage = "<a class='indexPage' href='".$purl."1'>$lang_index_page</a> \n";
}
else
{
$indexpage = "<span class='indexPage'>"."$lang_index_page \n"."</span>";
}
if($this->pageNO != $totalpage && $totalpage > 1)
{
$nextpage.="<a class='nextPage' href='".$purl."$nextpagenum'>$lang_next_page</a> \n";
$endpage="<a class='endPage' href='".$purl."$totalpage'>$lang_end_page</a> \n";
}
else
{
$endpage=" <strong>$lang_end_page</strong> \n";
}
//获得数字链接
$listdd = "";
$total_list = $atts['listsize'] * 2 + 1;
if($this->pageNO >= $total_list)
{
$j = $this->pageNO - $atts['listsize'];
$total_list=$this->pageNO + $atts['listsize'];
if($total_list > $totalpage)
{
$total_list = $totalpage;
}
}
else
{
$j=1;
if($total_list > $totalpage)
{
$total_list = $totalpage;
}
}
for($j; $j<=$total_list; $j++)
{
$listdd .= $j==$this->pageNO ? "<strong>$j</strong>\n" : "<a href='".$purl."$j'>".$j."</a>\n";
}
这个是代码。其中$purl .= "page-".$this->totalResult."&";
是我改的,本来是$purl .= "?".$geturl;
;但是我需要伪静态所以我改了,但是出这个问题,不知道怎么弄了。