search
Homephp教程PHP开发dedecms releases complete solution to paging problem

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 $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) //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        $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    $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)        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)!


Statement
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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

VSCode Windows 64-bit Download

VSCode Windows 64-bit Download

A free and powerful IDE editor launched by Microsoft

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.