随机颜色随机大小tags的修改方法_DedeCms教程
打开: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')));
其他的地方如需要调用可以自己改相对应的,做第二步即可
- Dedecms生成百度地图图文教程
- 织梦dedecms生成下拉式友情链接列表
- DEDECMS使用拼音首字母做栏目名称
- 织梦DEDECMS站群增强版 DedeCMS搭建站群首选
- DedeCMS Error:Tag disabled:php错误的完整处理方法
- dedecms编码转换方法 gbk转UTF-8,UTF-8转GBK
- 防XSS,sql注射,代码执行,文件包含的通用代码
- DedeCms教程:优化DedeCMS搜索结果
- DedeCms教程:Linux+Apache+PHP+MySQL服务器环境(CentOS篇)
- DedeCms教程:LuManager服务器管理软件安装DEDECMS软件
- DedeCms教程:Ubuntu/Debian上安装 PHP 5.3, Nginx 和 PHP-fpm
- DedeCms教程:windows server 2003 php 环境搭建