账号通
    

账号  

密码  

1400

查看

1

回复
主题:[求助]以前有个tags的贴字但是代码怎么用? [收藏主题]  
boylc123 当前离线

407

主题

2

广播

0

粉丝
添加关注
级别:四年级

用户积分:3846 分
登录次数:407 次
注册时间:2007/11/10
最后登录:2020/8/31
boylc123 发表于:2009/2/16 20:34:00   | 只看该作者 查看该作者主题 楼主 
科汛在线考试系统(NET)

修改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) & "&#10;被使用了" & SQL(2,I) &"次""><font "&srnd&">" & sql(0,i) & "</font></a>&nbsp;"
     end if
     if n>=cint(num) then exit for
    next
   
  End Function

 

请问版主这个代码应该怎么用呢?

 

 
  支持(0) | 反对(0) 回到顶部顶端 回到底部底部
一生有你 当前离线

10439

主题

0

广播

18

粉丝
添加关注
级别:版主

用户积分:72521 分
登录次数:1969 次
注册时间:2006/7/1
最后登录:2021/8/25
一生有你 发表于:2009/2/17 23:45:00   | 只看该作者 查看该作者主题 沙发 
v5.5没有channelid的,不再分频道了
 
  支持(0) | 反对(0) 回到顶部顶端 回到底部底部
<上一主题 | 下一主题 >
Powered By KesionCMS Version X1
厦门科汛软件有限公司 © 2006-2016 页面执行0.06055秒 powered by KesionCMS 9.0