隨機(jī)顏色隨機(jī)大小tags的修改方法_DedeCms教程

      編輯Tag賺U幣
      教程Tag:暫無Tag,歡迎添加,賺取U幣!

      打開:inc_channel_unit_functions.php
      找到函數(shù):
      function GetHotKeywords(
      .
      .
      .
      )
      替換為:
      //zouql-hotwords-b:
      //用法舉例:
      //調(diào)用熱門tags{dede:hotwords num='30' subday='30' istag='yes' /}
      //熱門搜索{dede:hotwords num='30' subday='30' istag='no' /}
      function GetHotKeywords($dsql,$num=8,$nday=365,$klen=16,$orderby='count',$istag='no'){
      global $cfg_phpurl;
      $nowtime = mytime();
      $num = ereg_replace("[^0-9]","",$num);
      $nday = ereg_replace("[^0-9]","",$nday);
      $klen = ereg_replace("[^0-9]","",$klen);
      if(empty($nday)) $nday = 365;
      if(empty($num)) $num = 6;
      if(empty($klen)) $klen = 16;
      if(empty($istag)) $istag = 'no';
      $klen = $klen+1;
      $mintime = $nowtime - ($nday * 24 * 3600);
      if(empty($orderby)) $orderby = 'count';
      if($istag=='no'){
      $dsql->SetQuery("Select keyword From dede_search_keywords where lasttime>$mintime And length(keyword)<$klen order by $orderby desc limit 0,$num");
      }
      elseif($istag=='yes'){
      $dsql->SetQuery("Select keyword,result,count From dede_search_keywords where lasttime>$mintime And istag=1 And length(keyword)<$klen order by $orderby desc limit 0,$num");
      }
      $dsql->Execute('hw');
      $hotword = "";
      if($istag=='no'){
      while($row=$dsql->GetArray('hw')){
      $hotword .= " <a href="".$cfg_phpurl."/search.php?keyword=".urlencode($row['keyword'])."&searchtype=titlekeyword" target="_blank">".$row['keyword']."</a> ";
      }
      }
      elseif($istag=='yes'){
      while($row=$dsql->GetArray('hw')){
      $hotword .= " <a href="".$cfg_phpurl."/search.php?keyword=".urlencode($row['keyword'])."&searchtype=titlekeyword" target="_blank" style=" font-size:".rand(14,20)."px;".rand_color()."" title="共".$row['result']."篇文章 搜索".$row['count']."次">".$row['keyword']."</a> ";
      }
      }
      return $hotword;
      }
      //zouql-hotwords-e

      //zouql-rcolor
      function rcolor() {
      srand((double)microtime()*10000000);
      $rand = (rand(15,235));
      return sprintf("%02X","$rand");
      }
      function rand_color() {
      $return = 'color:#'.rcolor().rcolor().rcolor();
      return $return;
      }
      //zouql-rcolor

      ----------------------------------------------------
      打開:inc_arcpart_view.php
      找到
      GetHotKeywords($this->dsql,$ctag->GetAtt('num'),$ctag->GetAtt('subday'),$ctag->GetAtt('maxlength'),$ctag->GetAtt('orderby')));
      改為
      GetHotKeywords($this->dsql,$ctag->GetAtt('num'),$ctag->GetAtt('subday'),$ctag->GetAtt('maxlength'),$ctag->GetAtt('orderby'),$ctag->GetAtt('istag')));

      其他的地方如需要調(diào)用可以自己改相對應(yīng)的,做第二步即可

      官方原帖:http://bbs.dedecms.com/read.php?tid=22317&fpage=4

      查看更多 DedeCms教程  織夢模板  織夢DedeCms視頻教程  織夢dedecms專題

      來源:DEDECMS論壇//所屬分類:DedeCms教程/更新時間:2008-03-07
      相關(guān)DedeCms教程