show_rnduser标签随机调用用户头像实现横向显示

By | 2008 年 4 月 22 日
show_rnduser(参数1,参数2,参数3,参数4,参数5,参数6)$
此标记随机调用用户头像。参数说明如下:
  参数1:调用条数。
  参数2:调用图片高度。推荐 48
  参数3:调用图片宽度。推荐 48
  参数4:是否只调用推荐/活跃。
1 只是推荐 10 只是推荐男生博客 11 只是推荐女生博客 2 按最后登录时间过滤 20按登录时间过滤男生 21按登录时间过滤女生
  参数5:调用多少天内登录过的活跃用户,以此来过滤用户。推荐 100
  参数6:是否只调用有自定义头像的用户。 0 否 1 是

 基于:oblog

缺少功能——横向显示,现添加。

修改过程

/inc/syscode.asp

一、添加“参数7”。(参数7:0 横向显示 1 竖向显示)

307行

G_P_Show=Replace(G_P_Show,label&”(“&tmpstr&”)$”,GetRndUser(para(0),para(1),para(2),para(3),para(4),para(5)))
  改成
 G_P_Show=Replace(G_P_Show,label&”(“&tmpstr&”)$”,GetRndUser(para(0),para(1),para(2),para(3),para(4),para(5),para(6)))

二、修改循环

 1254行开始

Function GetRndUser(num,width,height,types,dht,ishaveface)
 Dim rs,sql,Utype,UFdate,RndOrderBy,userurl
 UFdate = int(dht)
 If Err Then Err.clear:UFdate = 30
  If Is_Sqldata = 1 Then
RndOrderBy = ” Order By Newid()”
  Else
Randomize
RndOrderBy = ” Order By Rnd(-(UserID+”&Rnd()&”))”
  End If
  If ishaveface = “1” Then RndOrderBy=” and not(user_icon1 is null or user_icon1=”) ” & RndOrderBy
 Select Case types
  Case “1”
Utype= ” and user_isbest=1″
  Case “10”
Utype= ” and user_isbest=1 and sex=1″
  Case “11”
Utype= ” and user_isbest=1 and sex=0″
  Case “2”
Utype= ” and datediff(“&G_Sql_d&”,lastlogin,”&G_Sql_Now&”) <= “&UFdate
  Case “20”
Utype= ” and sex=1 and datediff(“&G_Sql_d&”,lastlogin,”&G_Sql_Now&”) <= “&UFdate
  Case “21”
Utype= ” and sex=0 and datediff(“&G_Sql_d&”,lastlogin,”&G_Sql_Now&”) <= “&UFdate
 End Select
  Set rs=oblog.execute(“select top “&num&” username,nickname,blogname,userid,user_dir,user_domain,user_domainroot,user_folder,user_icon1 from [oblog_user] where lockuser=0 and isdel=0 and (blog_password is null or blog_password=”)  “&Utype&” “&RndOrderBy)
  GetRndUser = Vbcrlf & “<ul id=””showrnduser””>” & Vbcrlf
 While Not rs.EOF
  If oblog.cacheConfig(5) = 1 Then
userurl = “http://” & Trim(rs(“user_domain”)) & “.” & Trim(rs(“user_domainroot”))
  Else
userurl = rs(“user_dir”) & “/” & rs(“user_folder”) & “/index.” & f_ext
  End If
GetRndUser=GetRndUser&”<li><a href=”””&userurl&””” target=””_blank”” title=””” & rs(2)& “””><img src=””” & OB_IIF(rs(8),”images/ico_default.gif”) & “”” width=”””&width&””” height=””” & height & “”” border=””0″” title=”””&rs(2)&”””/></a></li>” & vbcrlf
  rs.MoveNext
 Wend
 GetRndUser=GetRndUser&”</ul>” & Vbcrlf
 Set rs = Nothing

改成

Function GetRndUser(num,width,height,types,dht,ishaveface,oukan)
 Dim rs,sql,Utype,UFdate,RndOrderBy,userurl
 UFdate = int(dht)
 If Err Then Err.clear:UFdate = 30
  If Is_Sqldata = 1 Then
RndOrderBy = ” Order By Newid()”
  Else
Randomize
RndOrderBy = ” Order By Rnd(-(UserID+”&Rnd()&”))”
  End If
  If ishaveface = “1” Then RndOrderBy=” and not(user_icon1 is null or user_icon1=”) ” & RndOrderBy
 Select Case types
  Case “1”
Utype= ” and user_isbest=1″
  Case “10”
Utype= ” and user_isbest=1 and sex=1″
  Case “11”
Utype= ” and user_isbest=1 and sex=0″
  Case “2”
Utype= ” and datediff(“&G_Sql_d&”,lastlogin,”&G_Sql_Now&”) <= “&UFdate
  Case “20”
Utype= ” and sex=1 and datediff(“&G_Sql_d&”,lastlogin,”&G_Sql_Now&”) <= “&UFdate
  Case “21”
Utype= ” and sex=0 and datediff(“&G_Sql_d&”,lastlogin,”&G_Sql_Now&”) <= “&UFdate
 End Select
  Set rs=oblog.execute(“select top “&num&” username,nickname,blogname,userid,user_dir,user_domain,user_domainroot,user_folder,user_icon1 from [oblog_user] where lockuser=0 and isdel=0 and (blog_password is null or blog_password=”)  “&Utype&” “&RndOrderBy)
  GetRndUser = Vbcrlf & “<ul id=””showrnduser””>” & Vbcrlf
  If oukan = 0 Then
 While Not rs.EOF
  If oblog.cacheConfig(5) = 1 Then
userurl = “http://” & Trim(rs(“user_domain”)) & “.” & Trim(rs(“user_domainroot”))
  Else
userurl = rs(“user_dir”) & “/” & rs(“user_folder”) & “/index.” & f_ext
  End If
  GetRndUser=GetRndUser&”<a href=”””&userurl&””” target=””_blank”” title=””” & rs(2)& “””><img src=””” & OB_IIF(rs(8),”images/ico_default.gif”) & “”” width=”””&width&””” height=””” & height & “”” border=””0″” title=”””&rs(2)&”””/></a>” & vbcrlf
  rs.MoveNext
 Wend
  Else
   While Not rs.EOF
    If oblog.cach
eConfig(5) = 1 Then
userurl = “http://” & Trim(rs(“user_domain”)) & “.” & Trim(rs(“user_domainroot”))
  Else
userurl = rs(“user_dir”) & “/” & rs(“user_folder”) & “/index.” & f_ext
  End If
  GetRndUser=GetRndUser&”<li><a href=”””&userurl&””” target=””_blank”” title=””” & rs(2)& “””><img src=””” & OB_IIF(rs(8),”images/ico_default.gif”) & “”” width=”””&width&””” height=””” & height & “”” border=””0″” title=”””&rs(2)&”””/></a></li>” & vbcrlf
  rs.MoveNext
 Wend
 GetRndUser=GetRndUser&”</ul>” & Vbcrlf
  End If
 Set rs = Nothing

End Function

三、使用。

横排三个标签为:$show_rnduser(5,48,48,0,100,0,0)$

竖排三个标签为:$show_rnduser(5,48,48,0,100,0,1)$

四、已经修改好的inc/syscode.asp文件

 下载信息  [文件大小:11.0 KB]
点击浏览该文件:syscode.rar

o(∩_∩)o…,欢迎交流。

One thought on “show_rnduser标签随机调用用户头像实现横向显示

发表评论

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据