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

dedecms releases complete solution to paging problem

Dec 14, 2016 pm 04:21 PM

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


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

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

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Vue component practice: paging component development Vue component practice: paging component development Nov 24, 2023 am 08:56 AM

Vue component practice: Introduction to paging component development In web applications, the paging function is an essential component. A good paging component should be simple and clear in presentation, rich in functions, and easy to integrate and use. In this article, we will introduce how to use the Vue.js framework to develop a highly customizable paging component. We will explain in detail how to develop using Vue components through code examples. Technology stack Vue.js2.xJavaScript (ES6) HTML5 and CSS3 development environment

Detailed explanation of the principle of MyBatis paging plug-in Detailed explanation of the principle of MyBatis paging plug-in Feb 22, 2024 pm 03:42 PM

MyBatis is an excellent persistence layer framework. It supports database operations based on XML and annotations. It is simple and easy to use. It also provides a rich plug-in mechanism. Among them, the paging plug-in is one of the more frequently used plug-ins. This article will delve into the principles of the MyBatis paging plug-in and illustrate it with specific code examples. 1. Paging plug-in principle MyBatis itself does not provide native paging function, but you can use plug-ins to implement paging queries. The principle of paging plug-in is mainly to intercept MyBatis

Best way to implement array pagination in PHP Best way to implement array pagination in PHP May 04, 2024 pm 02:39 PM

There are two most common ways to paginate PHP arrays: using the array_slice() function: calculate the number of elements to skip, and then extract the specified range of elements. Use built-in iterators: implement the Iterator interface, and the rewind(), key(), current(), next(), and valid() methods are used to traverse elements within the specified range.

How to use Layui to develop a data display page with paging function How to use Layui to develop a data display page with paging function Oct 24, 2023 pm 01:10 PM

How to use Layui to develop a data display page with paging function Layui is a lightweight front-end UI framework that provides simple and beautiful interface components and a rich interactive experience. During development, we often encounter situations where we need to display large amounts of data and perform paging. The following is an example of a data display page with paging function developed using Layui. First, we need to introduce Layui related files and dependencies. Add the following code to the &lt;head&gt; tag of the html page

Where is the imperial cms resource network template? Where is the imperial cms resource network template? Apr 17, 2024 am 10:00 AM

Empire CMS template download location: Official template download: https://www.phome.net/template/ Third-party template website: https://www.dedecms.com/diy/https://www.0978.com.cn /https://www.jiaocheng.com/Installation method: Download template Unzip template Upload template Select template

How to use dedecms How to use dedecms Apr 16, 2024 pm 12:15 PM

Dedecms is an open source Chinese CMS system that provides content management, template system and security protection. The specific usage includes the following steps: 1. Install Dedecms. 2. Configure the database. 3. Log in to the management interface. 4. Create content. 5. Set up the template. 6. Manage users. 7. Maintain the system.

How to implement paging in jquery How to implement paging in jquery Dec 06, 2023 am 11:47 AM

Pagination can be implemented in jQuery using plug-ins or custom implementations. Custom implementation method: 1. Create a container in HTML to display paging; 2. Use jQuery in JavaScript to generate paging buttons, and bind the click event handler function to implement paging function; 3. In the showPage function, Calculate the starting and ending positions based on the current page number, and then display the data corresponding to the page number based on this position.

Interpret the operating principle of the MyBatis paging plug-in Interpret the operating principle of the MyBatis paging plug-in Feb 24, 2024 pm 07:24 PM

MyBatis is a popular persistence layer framework that makes it easier for Java developers to operate databases. One of the very practical functions is paging query. The paging data in the database can be obtained quickly and conveniently through the paging plug-in. This article will introduce the working mechanism of the MyBatis paging plug-in in detail, and use specific code examples to help readers better understand. The working principle of the MyBatis paging plug-in The working principle of the MyBatis paging plug-in is mainly to intercept SQL statements and query

See all articles