Home > php教程 > PHP开发 > dedecms releases complete solution to paging problem

dedecms releases complete solution to paging problem

黄舟
Release: 2016-12-14 16:21:29
Original
1541 people have browsed it

Due to the large amount of article content, dede has a very practical function in the system which is to automatically paginate articles. This function can be said to be very thoughtfully set up.

 However, a problem occurred while using it. How to solve the problem? Generally speaking, I first go to the dede forum and search to see if there are any relevant solutions. I searched a lot of articles related to automatic paging, but the problem has not been completely solved. Maybe there are some version problems or patches.

 I am using the 4.0 rcl version. The complete solution is as follows:

First, insert this code in the content page template (if it does not exist in the content page template) {dede:pagebreak/}, directly insert it in {dede:field name='body'/}.

  Then you can try using the automatic paging function to see if the problem is solved (probably not, hehe). If not, go to the next step


 Modify the file dede/article_description_action.php. Open the file and find the following code


The following is the quoted content:

/----------------------------
//Update automatically Pagination
//---------------------------------

if($dojob=='page'){
require_once(dirname( __FILE__)."/inc/inc_archives_functions.php");
//Total number of statistical records
if($totalnum==0){
$addquery = " where ID>0 ";
if($sid!=0) $ addquery = " And ID>='$sid' ";
if($eid!=0) $addquery = " And ID<='$eid' ";
$row = $dsql->GetOne("Select count (*) as dd From $table $addquery");
$totalnum = $row['dd'];
}
//Get records and analyze
if($totalnum > $startdd+$pagesize) $limitSql = " limit $startdd,$pagesize";
else if(($totalnum-$startdd)>0) $limitSql = " limit $startdd,".($totalnum - $startdd);
else $limitSql = "";
$tjnum = $startdd;
if($limitSql!=""){
$addquery = " where ID>0 ";
if($sid!=0) $addquery = " And ID>='$sid' "; F if ($ EID! = 0) $ addqury =" and ID & lt; = '$ EID' ";
$ FQuery =" Select Aid, $ Field from $ table $ limitsql; ""; & gt ;SetQuery($fquery);
                $dsql->Execute();                                                                                                                                                                                                            $aid = $row['aid'];
         if(strlen($body) < $msize) continue; SpLongBody($body,$cfg_arcautosp_size*1024,"#P#Page title#E#"); Body 'where aid =' $ aid '; "); -----------------------
//Update automatic paging
//------------------ ----------


if($dojob=='page'){
    require_once(dirname(__FILE__)."/inc/inc_archives_functions.php");
//统计记录总数
if($totalnum==0){
        $addquery = " where aID>0 ";
    if($sid!=0) $addquery .= " And aID>='$sid' ";
    if($eid!=0) $addquery .= " And aID<='$eid' ";
        $row = $dsql->GetOne("Select count(*) as dd From $table $addquery");
        $totalnum = $row['dd'];
}
//获取记录,并分析
if($totalnum > $startdd+$pagesize) $limitSql = " limit $startdd,$pagesize";
else if(($totalnum-$startdd)>0) $limitSql = " limit $startdd,".($totalnum - $startdd);
else $limitSql = "";
$tjnum = $startdd;
if($limitSql!=""){
    $addquery = " where aID>0 ";

 

    if($sid!=0) $addquery .= " And aID>='$sid' ";
    if($eid!=0) $addquery .= " And aID<='$eid' ";
    $fquery = "Select aid,$field From $table $addquery $limitSql ;";
    $dsql->SetQuery($fquery);
    $dsql->Execute();
      while($row=$dsql->GetArray())
      {
       $tjnum++;
       $body = $row[$field];
       $aid = $row['aid'];
       if(strlen($body) < $msize) continue;
       if(!preg_match("/#P#/iU",$body)){
          $body = SpLongBody($body,$cfg_arcautosp_size*1024,"#P#分页标题#E#");
          $body = addslashes($body); 
          $dsql->ExecuteNoneQuery("Update $table set $field='$body' where aid='$aid' ; ");
       }
      }
    }//end if limit

 


  然后保存上传。问题应该可以完全解决。

 

  看了某些网友写的出现此问题的原因是在数据表中没有发现id字段。只有aid字段,修改即可。

 更多相关文章请关注PHP中文网(www.php.cn)!


Related labels:
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template