账号通
    

账号  

密码  

9832

查看

21

回复
主题:我改写的GetTags,支持多种样式的热门标签 [收藏主题] 本贴被认定为精华 转到:  
ccfleaf 当前离线

67

主题

0

广播

0

粉丝
添加关注
级别:学前班

用户积分:1199 分
登录次数:85 次
注册时间:2006/11/10
最后登录:2012/3/27
ccfleaf 发表于:2008/7/18 10:39: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) 回到顶部顶端 回到底部底部
ccfleaf 当前离线

67

主题

0

广播

0

粉丝
添加关注
级别:学前班

用户积分:1199 分
登录次数:85 次
注册时间:2006/11/10
最后登录:2012/3/27
ccfleaf 发表于:2008/7/19 0:38:00   | 显示全部帖子 查看该作者主题 沙发 
科汛智能建站系统
是5.0的,4.5的在好象在ks.rcls.asp中
 
  支持(0) | 反对(0) 回到顶部顶端 回到底部底部
<上一主题 | 下一主题 >
Powered By KesionCMS Version X1
厦门科汛软件有限公司 © 2006-2016 页面执行0.07031秒 powered by KesionCMS 9.0