WEB开发网
开发学院CMS教程织梦CMS 随机颜色随机大小tags的修改方法 阅读

随机颜色随机大小tags的修改方法

 2009-10-16 15:42:00 来源:WEB开发网   
核心提示:打开:inc_channel_unit_functions.php找到函数:function GetHotKeywords(...)替换为://zouql-hotwords-b://用法举例://调用热门tags{dede:hotwords num='30' subday='30' is

打开:inc_channel_unit_functions.php
找到函数:
function GetHotKeywords(
.
.
.
)
替换为:
//zouql-hotwords-b:
//用法举例:
//调用热门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')));

其他的地方如需要调用可以自己改相对应的,做第二步即可

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

Tags:随机 颜色 随机

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接