婷婷综合国产,91蜜桃婷婷狠狠久久综合9色 ,九九九九九精品,国产综合av

主頁 > 網站建設 > 建站知識 > 織夢dedecms程序sql標簽實現分頁功能

織夢dedecms程序sql標簽實現分頁功能

POST TIME:2018-01-11 22:01

{dede:list pagesize='7'}{/dede:list}改用{dede:listsql}調用的方法

打開include/arc.listview.class.php

找到:

if(!is_object($ctag)) { $ctag = $this->dtp->GetTag("list"); }
這一段,在其后添加如下代碼:

if(!is_object($ctag)) { $ctag = $this->dtp->GetTag("listsql"); if (is_object($ctag)) { $cquery = $ctag->GetAtt("sql"); $cquery = preg_replace("/SELECT(.*?)FROM/is", " SELECT count(*) as dd FROM ", $cquery); $cquery = preg_replace("/ORDER(.*?)SC/is", "", $cquery); $row = $this->dsql->GetOne($cquery); if(is_array($row)) { $this->TotalResult = $row['dd']; } else { $this->TotalResult = 0; } } } //end

然后找到:

if($ctag->GetName()=="list") { $limitstart = ($this->PageNo-1) * $this->PageSize; $row = $this->PageSize; if(trim($ctag->GetInnerText())=="") { $InnerText = GetSysTemplets("list_fulllist.htm"); } else { $InnerText = trim($ctag->GetInnerText()); } $this->dtp->Assign($tagid, $this->GetArcList( $limitstart, $row, $ctag->GetAtt("col"), $ctag->GetAtt("titlelen"), $ctag->GetAtt("infolen"), $ctag->GetAtt("imgwidth"), $ctag->GetAtt("imgheight"), $ctag->GetAtt("listtype"), $ctag->GetAtt("orderby"), $InnerText, $ctag->GetAtt("tablewidth"), $ismake, $ctag->GetAtt("orderway") ) ); }
這一段,在其后添加如下代碼:

else if($ctag->GetName()=="listsql") { $limitstart = ($this->PageNo-1) * $this->PageSize; $row = $this->PageSize; if(trim($ctag->GetInnerText())=="") { $InnerText = GetSysTemplets("list_fulllist.htm"); } else { $InnerText = trim($ctag->GetInnerText()); } $this->dtp->Assign($tagid, $this->GetSqlList( $limitstart, $row, $ctag->GetAtt("sql"), $InnerText ) ); } //end
最后找到function GetArcList這個方法,在其后添加一個可以通過傳入sql參數獲取指定數據源的方法,代碼如下:

/** * 通過listsql標簽中sql屬性傳入的參數來獲得一個單列的文檔列表 * */ function GetSqlList($limitstart = 0, $row = 10, $sql = '', $innertext){ global $cfg_list_son; $innertext = trim($innertext); if ($innertext == '') { $innertext = GetSysTemplets('list_fulllist.htm'); } //處理SQL語句 $limitStr = " LIMIT {$limitstart},{$row}"; $this->dsql->SetQuery($sql . $limitStr); $this->dsql->Execute('al'); $t2 = ExecTime(); //echo $t2-$t1; $sqllist = ''; $this->dtp2->LoadSource($innertext); $GLOBALS['autoindex'] = 0; //獲取字段 while($row = $this->dsql->GetArray("al")) { $GLOBALS['autoindex']++; if(is_array($this->dtp2->CTags)) { foreach($this->dtp2->CTags as $k=>$ctag) { if($ctag->GetName()=='array') { //傳遞整個數組,在runphp模式中有特殊作用 $this->dtp2->Assign($k,$row); } else { if(isset($row[$ctag->GetName()])) { $this->dtp2->Assign($k,$row[$ctag->GetName()]); } else { $this->dtp2->Assign($k,''); } } } } $sqllist .= $this->dtp2->GetResult(); }//while $t3 = ExecTime(); //echo ($t3-$t2); $this->dsql->FreeResult('al'); return $sqllist; } //end

 



收縮
  • 微信客服
  • 微信二維碼
  • 電話咨詢

  • 400-1100-266
主站蜘蛛池模板: 合阳县| 广水市| 仙桃市| 石家庄市| 紫云| 景宁| 甘孜县| 米易县| 九江市| 通海县| 右玉县| 林芝县| 平远县| 黄浦区| 天柱县| 噶尔县| 奉化市| 独山县| 略阳县| 射阳县| 临朐县| 内丘县| 安龙县| 靖边县| 屏东县| 新营市| 伊吾县| 雷波县| 繁昌县| 南开区| 绥棱县| 兴仁县| 五原县| 屏山县| 绵阳市| 化州市| 道孚县| 玉门市| 金塔县| 蚌埠市| 西丰县|