Dedecms member space does not support paging Solution

Source: Internet
Author: User

When I used dedecms, I found a strange bug, that is, all the content in the member space could not be paged, and I could not find a solution on the official forum. Instead, I had to automatically find the cause, the final result is include/arc. memberlistview. class. for the PHP file, find the file and replace the following code with the original one.

<? PHP if (! Defined ('deinc') Exit ("request error! "); Require_once (dedeinc. "/dedetemplate. class. PHP "); $ lang_pre_page = 'previous page'; $ lang_next_page = 'Next page'; $ lang_index_page = 'homepage '; $ lang_end_page = 'last page'; $ lang_record_number = 'record '; $ lang_page = 'page'; $ lang_total = 'col'; Class memberlistview {var $ dsql = ''; var $ TPL =''; var $ pageno = 1; vaR $ totalpage = 0; var $ totalresult = 0; var $ pagesize = 25; var $ getvalues = array (); var $ sourcesql = ''; var $ isquery = false; vaR $ Randts = 0; /*** initialize with the specified document ID ** @ access public * @ Param string $ tplfile template file * @ return void */function _ construct ($ tplfile ='') {$ this-> sourcesql = ''; $ this-> pagesize = 25; $ this-> querytime = 0; $ this-> getvalues = array (); $ this-> randts = Time (); $ this-> dsql = $ globals ['dsql']; $ this-> setvar ('parseenv', 'datalist '); $ this-> TPL = new dedetemplate (); if ($ globals ['cfg _ tplcache '] = 'n') {$ this-> TPL-> iscache = false ;} If ($ tplfile! = '') {$ This-> TPL-> loadtemplate ($ tplfile) ;}// compatible with php4function memberlistview ($ tplfile = '') {$ this->__ construct ($ tplfile );} /*** set the SQL statement ** @ access public * @ Param string $ SQL statement * @ return void */function setsource ($ SQL) {$ this-> sourcesql = $ SQL;}/*** set template * if you want to use the pagesize specified in the template, you must call setsource ($ SQL) only after calling the template) ** @ access public * @ Param string $ tplfile template file * @ return void */function settemplate ($ tplfile) {$ this-> TPL-> Loadtemplate ($ tplfile);}/*** set template ** @ access public * @ Param string $ tplfile template file * @ return void */function settemplet ($ tplfile) {$ this-> TPL-> loadtemplate ($ tplfile );} /*** pre-process config and get parameters ** @ access private * @ return void */function preload () {Global $ totalresult, $ pageno; if (empty ($ pageno) | preg_match ("/[^ 0-9]/", $ pageno) {$ pageno = 1;} If (empty ($ totalresult) | preg_match ("/[^ 0-9]/", $ totalresult )){ $ Totalresult = 0 ;}$ this-> pageno = $ pageno; $ this-> totalresult = $ totalresult; if (isset ($ this-> TPL-> tpcfgs ['pagesize']) {$ this-> pagesize = $ this-> TPL-> tpcfgs ['pagesize'];} $ this-> totalpage = Ceil ($ this-> totalresult/$ this-> pagesize); if ($ this-> totalresult = 0) {// $ this-> isquery = true; // $ this-> dsql-> execute ('mbdl ', $ this-> sourcesql ); // $ this-> totalresult = $ this-> dsql-> gettotalrow ('mbdl '); // $ countquery = Pr Eg_replace ("/select [\ r \ n \ t] (. *) [\ r \ n \ t] From/I "," select count (*) as DD from ", $ this-> sourcesql ); $ countquery = preg_replace ("# select [\ r \ n \ t] (. *) [\ r \ n \ t] From # is ", 'select count (*) as DD from', $ this-> sourcesql ); $ countquery = preg_replace ("# order [\ r \ n \ t] {1,} (. *) # is ",'', $ countquery); $ ROW = $ this-> dsql-> getone ($ countquery ); $ row ['dd'] = empty ($ row ['dd'])? 0: $ row ['dd']; $ this-> totalresult = $ row ['dd']; $ this-> sourcesql. = "Limit 0 ,". $ this-> pagesize;} else {$ this-> sourcesql. = "limit ". ($ this-> pageNO-1) * $ this-> pagesize ). ",". $ this-> pagesize ;}} /*** set the URL's get parameter key value ** @ access public * @ Param string $ key * @ Param string $ value * @ return void */function setparameter ($ key, $ value) {$ this-> getvalues [$ key] = $ value;}/*** sets/obtains various variables related to documents ** @ access public * @ Param String $ K key * @ Param string $ V value * @ return void */function setvar ($ K, $ v) {Global $ _ vars; If (! Isset ($ _ vars [$ K]) $ _ vars [$ K] = $ V ;} /*** get value ** @ Param string $ K * @ return string */function getvar ($ K) {Global $ _ vars; if (isset ($ _ vars [$ K]) return $ _ vars [$ K]; else return '';} /*** get the current page data list ** @ access public * @ Param string $ ATTS attribute * @ Param string $ refobj instantiated object * @ Param string $ fields field * @ return Array */function getarclist ($ ATTS, $ refobj = '', $ fields = array () {$ ATTLIST =" titlelen = 30, infolen = 200, imgwidth = 120, Imgheight = 90 "; fillatts ($ ATTS, $ ATTLIST); fillfields ($ ATTS, $ fields, $ refobj); extract ($ ATTS, extr_overwrite ); $ rsarray = array (); // global $ _ vars; // $ T1 = exectime (); If (! $ This-> isquery) {$ this-> dsql-> execute ('mbdl ', $ this-> sourcesql);} $ I = 0; while ($ ROW = $ this-> dsql-> getarray ('mbdl ') {$ I ++; If (! Isset ($ row ['description']) $ row ['description'] = ''; If (! Isset ($ row ['color']) $ row ['color'] = ''; If (! Isset ($ row ['pubdate']) $ row ['pubdate'] = $ row ['senddate']; // process some special fields $ row ['infos '] = cn_substr ($ row ['description'], $ infolen ); $ row ['id'] = $ row ['id']; $ row ['filename'] = $ row ['arcurl'] = getfileurl ($ row ['id'], $ row ['typeid'], $ row ['senddate'], $ row ['title'], $ row ['ismake'], $ row ['arcrank '], $ row ['namerule'], $ row ['typedir'], $ row ['money'], $ row ['filename'], $ row ['moresite '], $ row ['siteurl'], $ row ['sitepath']); $ R Ow ['typeurl'] = gettypeurl ($ row ['typeid'], $ row ['typedir'], $ row ['isdefault'], $ row ['defaultname'], $ row ['ispart'], $ row ['namerule2'], $ row ['moresite '], $ row ['siteurl'], $ row ['sitepath']); if ($ row ['litpic '] ='-'| $ row ['litpic'] = '') {$ row ['litpic '] = $ globals ['cfg _ cmspath']. '/images/defapicpic.gif';} If (! Preg_match ("/^ http: \ // I", $ row ['litpic ']) & $ globals ['cfg _ multi_site'] = 'y ') {$ row ['litpic '] = $ globals ['cfg _ mainsite']. $ row ['litpic '];} $ row ['picname'] = $ row ['litpic']; $ row ['stime'] = getdatemk ($ row ['pubdate']); $ row ['typelink'] = "<a href = '". $ row ['typeurl']. "'> ". $ row ['typename']. "</a>"; $ row ['image'] = " <]/", "", $ row ['title']). "'>"; $ row ['imglink'] = "<a href = '". $ row ['filename']. "'> ". $ row ['image']. "</a>"; $ row ['fulltitle'] = $ row ['title']; $ row ['title'] = cn_substr ($ row ['title'], $ titlelen); if ($ row ['color']! = '') {$ Row ['title'] =" <font color = '". $ row ['color']. "'> ". $ row ['title']. "</font>";} If (preg_match ('/B/', $ row ['flag']) {$ row ['title'] = "<strong> ". $ row ['title']. "</strong>" ;}// $ row ['title'] = "<B> ". $ row ['title']. "</B>"; $ row ['textlink'] = "<a href = '". $ row ['filename']. "'> ". $ row ['title']. "</a>"; $ row ['plusurl'] = $ row ['phpurl'] = $ globals ['cfg _ phpurl']; $ row ['memberurl'] = $ globals ['cfg _ memberurl']; $ row ['t Empleturl '] = $ globals ['cfg _ templeturl']; $ rsarray [$ I] = $ row; if ($ I >=$ this-> pagesize) {break ;}$ this-> dsql-> freeresult (); // echo "execution time :". (exectime ()-$ T1); return $ rsarray ;} /*** retrieve the paging navigation list ** @ access public * @ Param string $ ATTS attribute * @ Param string $ refobj instantiate the object * @ Param string $ fields field * @ return string * /function getpagelist ($ ATTS, $ refobj = '', $ fields = array () {Global $ lang_pre_page, $ lang_next_page, $ lang_in Dex_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 there is no result or there is only one page ($ totalpage <= 1 & $ this-> totalresult> 0) {return "{$ lang_total} 1 {$ lang_page }/". $ this-> totalresult. $ lang_record_number;} if ($ this-> totalresult = 0) {return "{$ lang_total} 0 {$ lang_page }/". $ This-> totalresult. $ lang_record_number ;} $ 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 = 'ddn' name = '$ key' value =' $ value'> \ r \ n" ;}}$ Purl. = "? ". $ Geturl; // get the link of the previous and next pages if ($ this-> pageno! = 1) {$ prepage. = "<a href = '". $ Purl. "pageno = $ prepagenum '> $ lang_pre_page </a> \ r \ n"; $ indexpage = "<a href = '". $ Purl. "pageno = 1'> $ lang_index_page </a> \ r \ n";} else {$ indexpage = "$ lang_index_page \ r \ n ";} if ($ this-> pageno! = $ Totalpage & $ totalpage> 1) {$ nextpage. = "<a href = '". $ Purl. "pageno = $ nextpagenum '> $ lang_next_page </a> \ r \ n"; $ endpage = "<a href = '". $ Purl. "pageno = $ totalpage '> $ lang_end_page </a> \ r \ n";} else {$ endpage = "$ lang_end_page \ r \ n ";} // obtain the numeric link $ 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> $ t Otalpage) {$ total_list = $ totalpage;} else {$ j = 1; if ($ total_list> $ totalpage) $ total_list = $ totalpage;} For ($ J; $ j <= $ total_list; $ J ++) {if ($ J = $ this-> pageno) {$ listdd. = "<strong> $ j </strong> \ r \ n";} else {$ listdd. = "<a href = '". $ Purl. "pageno = $ J'> ". $ J. "</a> \ r \ n" ;}}$ plist = "<Div class = \" pagelistbox \ "> \ r \ n"; // info, index, end, pre, next, pageno, formif (preg_match ("/INFO/I", $ ATTS ['listitem']) {$ plist. = $ Infos;} If (preg_ma Tch ("/index/I", $ ATTS ['listitem']) {$ plist. = $ indexpage;} If (preg_match ("/PRE/I", $ ATTS ['listitem']) {$ plist. = $ prepage;} If (preg_match ("/pageno/I", $ ATTS ['listitem']) {$ plist. = $ listdd;} If (preg_match ("/next/I", $ ATTS ['listitem']) {$ plist. = $ nextpage;} If (preg_match ("/end/I", $ ATTS ['listitem']) {$ plist. = $ endpage;} If (preg_match ("/form/I", $ ATTS ['listitem']) {$ plist. = "<form name = 'pagelist' action = '". $ This-> getcururl (). "'> $ hidenform"; if ($ totalpage> $ total_list) {$ plist. = "<input type = 'text' name = 'pageno' style = 'padding: 0px; width: 30px; Height: 18px '> \ r \ n"; $ plist. = "<input type = 'submit 'name = 'plistgo' value = 'Go' style = 'padding: 0px; width: 30px; Height: 18px; font-size: 11px '> \ r \ n ";} $ plist. = "</form> \ r \ n";} $ plist. = "</div> \ r \ n"; return $ plist;}/*** get the current URL ** @ access public * @ return string */function getcururl () {If (! Empty ($ _ server ["request_uri"]) {$ nowurl = $ _ server ["request_uri"]; $ nowurls = explode ("? ", $ Nowurl); $ nowurl = $ nowurls [0];} else {$ nowurl = $ _ server [" php_self "];} return $ nowurl ;} // close function close () {}/** display data ** @ access public * @ return void */function display () {if ($ this-> sourcesql! = '') $ This-> preload (); // In PhP4, object references must be placed before display, $ this-> TPL-> setobject ($ this); $ this-> TPL-> display ();} /*** save as HTML ** @ access public * @ Param string $ filename file name * @ return string */function saveto ($ filename) {$ this-> TPL-> saveto ($ filename) ;}// end class

Dedecms member space does not support paging Solution


Dedecms member space does not support paging Solution

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.