修正dedecms自由列表生成html时,一个栏目超过1页的逻辑处理的错误

来源:互联网 发布:js的replace方法 编辑:程序博客网 时间:2024/06/03 17:36

makehtml_freelist_action.php?mkpage=51&maxpagesize=50&startid=18&endid=18&pageno=0这个php


//如果栏目的文档太多,分多批次更新
if($ntotalpage<=$maxpagesize)
{
 $lv->MakeHtml();
 $finishType = true;
  $nextpage = $pageno+1;//这句应该写到二个{}中来,原来的放到外面,如果出现大于50的情况时就只生成前面的50页后就说完成了,但是页码却显示大于50,如我的是64页,但是html只生成到50,而页码却显示64页.
}else
{
 $lv->MakeHtml($mkpage,$maxpagesize);
 $finishType = false;
 $mkpage = $mkpage + $maxpagesize;
 if( $mkpage >= ($ntotalpage+1) )
 {
  $finishType = true;
  $nextpage = $pageno+1;
 }
}
$lv->Close();
if($nextpage==$totalpage)
{


而在这个phhp引用 的class中就是makehtml中,在大开页码时,不加上1


 //列表创建HTML
 function MakeHtml($startpage = 1, $makepagesize = 0) {
  $this->LoadTemplet();

//echo "<pre>",print_r($this->FLInfos),"</pre>";

  $murl = "";
  if (empty ($startpage)) {
   $startpage = 1;
  }
  $this->ParseTempletsFirst();
  $totalpage = ceil($this->TotalResult / $this->PageSize);
  if ($totalpage == 0) {
   $totalpage = 1;
  }
  if ($makepagesize > 0) {
   $endpage = $startpage + $makepagesize;
  } else {
   $endpage = ($totalpage +1);
  }
  if ($endpage > ($totalpage +1)) {
   $endpage = $totalpage + 1;//这里要加上1,要不,最后那码最是不生成html
  }
  $firstFile = '';
  for ($this->PageNo = $startpage; $this->PageNo < $endpage; $this->PageNo++) {
   $this->ParseDMFields($this->PageNo, 1);

 

 

二个页面的错误会导致超过1页,只生成前面50页,却显示超过50页的页码显示,那么点击后面的肯定不存在了,

 

而class中的错误导致在超过1页时,最后那页不生成html,因为其它判断上都加1,且for中使用了<并没有=

 

 

 

原创粉丝点击