欧美乱伦图片区,国产日韩欧美一区二区三区四区五区,欧美性色爽,乱伦小说网站免费观看视频,啊用力啊好深啊H在线观看,男女做哎爱过程图片

信息動(dòng)態(tài)

網(wǎng)站設(shè)計(jì)是技術(shù)與創(chuàng)意的完美融合!

技術(shù)資訊

dede:sql 調(diào)用flag att文檔屬性 翻頁(yè)

2014-07-25 12:40:12

dede:sql標(biāo)簽分頁(yè) dede:sql 調(diào)用flag/att文檔屬性 翻頁(yè),青島網(wǎng)站建設(shè)中有時(shí)候需要在頁(yè)面上通過(guò)sql語(yǔ)句調(diào)用其他數(shù)據(jù)庫(kù)或者其他表的數(shù)據(jù),例如在當(dāng)前列表頁(yè)調(diào)用一個(gè)特定文檔屬性的文章列表,再加上翻頁(yè),效果就不好處理了,需要對(duì)arc.listview.class.php進(jìn)行改造,方法在這篇文章有描述  DEDE{dede:sql}標(biāo)簽如何分頁(yè) ,下文最后會(huì)在描述一遍,改造完著文件后,就可以這樣調(diào)用了。

{dede:listsql pagesize='1' sql="select a.id as aid, a.description as description, t.id as tid,typeid,senddate,title,litpic,ismake,arcrank,namerule,typedir From ltd_archives a, ltd_arctype t where a.typeid = t.id and FIND_IN_SET('f', flag)>0" }

<li><a href="[field:array runphp='yes']@me=GetFileUrl(@me['aid'],@me['typeid'],@me['senddate'],@me['title'],@me['ismake'],@me['description'],@me['arcrank'],@me['namerule'],@me['typedir'],@me['money']);[/field:array]"><img src="[field:litpic/]" width="304" height="158" /><h4>[field:title/]</h4>

<h5>[field:senddate function='strftime("%Y-%m-%d",@me)'/]</h5>

<p>[field:description/]...</p></a>

</li>

{/dede:listsql}

                            <div class="page">

<!--分頁(yè)-->

{dede:pagelist listsize='1' listitem='pre pageno next'/}

 

</div>

 

 

arc.listview.class.php進(jìn)行改造,方法:

找到:

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這個(gè)方法,在其后添加一個(gè)可以通過(guò)傳入sql參數(shù)獲取指定數(shù)據(jù)源的方法,代碼如下:


 function GetSqlList($limitstart = 0, $row = 10, $sql = '', $innertext){
 
  global $cfg_list_son;
  $innertext = trim($innertext);
 
  if ($innertext == '') {
   $innertext = GetSysTemplets('list_fulllist.htm');
  }
  //處理SQL語(yǔ)句
  $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')
     {
      //傳遞整個(gè)數(shù)組,在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

 

0532-85810878 473587358 掃碼添加微信

掃碼添加微信

掃碼關(guān)注公眾號(hào)

官方公眾號(hào)

2054585360
定边县| 盖州市| 垦利县| 宁南县| 织金县| 黎城县| 绥芬河市| 易门县| 长兴县| 高陵县| 江孜县| 苍梧县| 东光县| 胶南市| 封丘县| 九龙城区| 高雄县| 湘潭市| 禹州市| 衢州市| 虞城县| 阜平县| 青州市| 台东县| 阳江市| 临泽县| 平原县| 石阡县| 大邑县| 通化县| 嘉定区| 长垣县| 丰顺县| 酒泉市| 湖北省| 来安县| 满城县| 永清县| 秦皇岛市| 米泉市| 五华县|