修改kession.label.commoncls.asp中的GetTags函数
Function MyRnd(NumMin,NumMax)
Randomize
MyRnd = Int(Rnd * (NumMax - NumMin + 1)) + NumMin
End Function
'TagChannel可以指定ChannelID,生成对应栏目的热门标签,为空时,生成所有栏目热门标签
'isRnd指定样式,1:字体不一;2:颜色不一;3:字体和颜色都不一;其它:默认方式
Function GetTags(TagType,Num,TagChannel,isRnd)
if not isnumeric(num) then exit function
dim sqlstr,sql,i,n,str,srnd,col(6)
col(0)="BLACK"
col(1)="RED"
col(2)="BLUE"
col(3)="GREEN"
select case cint(tagtype)
case 1:
if TagChannel="" then
sqlstr="select top 500 keytext,channelid,hits from ks_keywords order by hits desc"
else
sqlstr="select top 500 keytext,channelid,hits from ks_keywords where channelid="&TagChannel&" order by hits desc"
end if
case 2:
if TagChannel="" then
sqlstr="select top 500 keytext,channelid,hits from ks_keywords order by lastusetime desc,id desc"
else
sqlstr="select top 500 keytext,channelid,hits from ks_keywords where channelid="&TagChannel&" order by lastusetime desc,id desc"
end if
case 3:
if TagChannel="" then
sqlstr="select top 500 keytext,channelid,hits from ks_keywords order by Adddate desc,id desc"
else
sqlstr="select top 500 keytext,channelid,hits from ks_keywords where channelid="&TagChannel&" order by Adddate desc,id desc"
end if
case else
GetTags="":exit function
end select
dim rs:set rs=conn.execute(sqlstr)
if rs.eof then rs.close:set rs=nothing:exit function
sql=rs.getrows(-1)
rs.close:set rs=nothing
for i=0 to ubound(sql,2)
if isRnd=1 then
srnd = "size="&MyRnd(2,5)&""
elseif isRnd=2 then
srnd = "color="&col(MyRnd(0,3))&""
elseif isRnd=3 then
srnd = "color="&col(MyRnd(0,3))&" size="&MyRnd(2,5)&""
end if
if KS.FoundInArr(str,sql(0,i),",")=false then
n=n+1
str=str & "," & sql(0,i)
gettags=gettags & "<a href=""{$GetSiteUrl}plus/search.asp?searchtype=5&channelid=" & sql(1,i) & "&tags=" & sql(0,i)& """ target=""_blank"" title=""TAG:" & sql(0,i) & " 被使用了" & SQL(2,I) &"次""><font "&srnd&">" & sql(0,i) & "</font></a> "
end if
if n>=cint(num) then exit for
next
End Function