1 if(!is_object($ctag)) 2 { 3 $ctag = $this->dtp->GetTag("list"); 4 }
01 if(!is_object($ctag)) 02 { 03 $ctag = $this->dtp->GetTag("listsql"); 04 if (is_object($ctag)) 05 { 06 $cquery = $ctag->GetAtt("sql"); 07 $cquery = preg_replace("/SELECT(.*?)FROM/is", " SELECt count(*) as dd FROM ", $cquery); 08 $cquery = preg_replace("/ORDER(.*?)SC/is", "", $cquery); 09 $row = $this->dsql->GetOne($cquery); 10 if(is_array($row)) 11 { 12 $this->TotalResult = $row['dd']; 13 } 14 else 15 { 16 $this->TotalResult = 0; 17 } 18 } 19 } 20 //end
01 if($ctag->GetName()=="list") 02 { 03 $limitstart = ($this->PageNo-1) * $this->PageSize; 04 $row = $this->PageSize; 05 if(trim($ctag->GetInnerText())=="") 06 { 07 $InnerText = GetSysTemplets("list_fulllist.htm"); 08 } 09 else 10 { 11 $InnerText = trim($ctag->GetInnerText()); 12 } 13 $this->dtp->Assign($tagid, 14 $this->GetArcList( 15 $limitstart, 16 $row, 17 $ctag->GetAtt("col"), 18 $ctag->GetAtt("titlelen"), 19 $ctag->GetAtt("infolen"), 20 $ctag->GetAtt("imgwidth"), 21 $ctag->GetAtt("imgheight"), 22 $ctag->GetAtt("listtype"), 23 $ctag->GetAtt("orderby"), 24 $InnerText, 25 $ctag->GetAtt("tablewidth"), 26 $ismake, 27 $ctag->GetAtt("orderway") 28 ) 29 ); 30 }
01 else if($ctag->GetName()=="listsql") 02 { 03 $limitstart = ($this->PageNo-1) * $this->PageSize; 04 $row = $this->PageSize; 05 if(trim($ctag->GetInnerText())=="") 06 { 07 $InnerText = GetSysTemplets("list_fulllist.htm"); 08 } 09 else 10 { 11 $InnerText = trim($ctag->GetInnerText()); 12 } 13 $this->dtp->Assign($tagid, 14 $this->GetSqlList( 15 $limitstart, 16 $row, 17 $ctag->GetAtt("sql"), 18 $InnerText 19 ) 20 ); 21 } 22 //end
01 04 function GetSqlList($limitstart = 0, $row = 10, $sql = '', $innertext){ 05 06 global $cfg_list_son; 07 $innertext = trim($innertext); 08 09 if ($innertext == '') { 10 $innertext = GetSysTemplets('list_fulllist.htm'); 11 } 12 //处理SQL语句 13 $limitStr = " LIMIT {$limitstart},{$row}"; 14 15 $this->dsql->SetQuery($sql . $limitStr); 16 $this->dsql->Execute('al'); 17 $t2 = ExecTime(); 18 19 //echo $t2-$t1; 20 $sqllist = ''; 21 $this->dtp2->LoadSource($innertext); 22 $GLOBALS['autoindex'] = 0; 23 24 //获取字段 25 while($row = $this->dsql->GetArray("al")) { 26 27 $GLOBALS['autoindex']++; 28 29 if(is_array($this->dtp2->CTags)) 30 { 31 foreach($this->dtp2->CTags as $k=>$ctag) 32 { 33 if($ctag->GetName()=='array') 34 { 35 //传递整个数组,在runphp模式中有特殊作用 36 $this->dtp2->Assign($k,$row); 37 } 38 else 39 { 40 if(isset($row[$ctag->GetName()])) 41 { 42 $this->dtp2->Assign($k,$row[$ctag->GetName()]); 43 } 44 else 45 { 46 $this->dtp2->Assign($k,''); 47 } 48 } 49 } 50 } 51 52 $sqllist .= $this->dtp2->GetResult(); 53 54 }//while 55 56 $t3 = ExecTime(); 57 //echo ($t3-$t2); 58 $this->dsql->FreeResult('al'); 59 60 return $sqllist; 61 } 62 //end
1 {dede:listsql sql='select ID,post_title from wp_posts' pagesize='10'} 2
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)