首页 > 运营 > 建站指南 > 正文

标题过长,在后面加上省略号

2020-04-15 12:26:51
字体:
来源:转载
供稿:网友

直接修改根/inc/Function.asp中的:

Function GotTopic(Str,StrLen)
Dim l,t,c, i,LableStr,regEx,Match,Matches,tLen
if IsNull(Str) then
GotTopic = ""
Exit Function
end if
if Str = "" then
GotTopic=""
Exit Function
end if
Set regEx = New RegExp
regEx.Pattern = "/[[^/[/]]*/]"
regEx.IgnoreCase = True
regEx.Global = True
Set Matches = regEx.Execute(Str)
For Each Match in Matches
LableStr = LableStr & Match.Value
Next
Str = regEx.Replace(Str,"")
Str=Replace(Replace(Replace(Replace(Str,"&nbsp;"," "),"&quot;",Chr(34)),"&gt;",">"),"&lt;","<")
l=len(str)
t=0
tLen = Clng(StrLen) - 2
for i=1 to l
c=Abs(Asc(Mid(str,i,1)))
if c>255 then
t=t 2
else
t=t 1
end if
if t>=tLen then
GotTopic=left(str,i)&"...."
exit for
else
GotTopic=str
end if
next
GotTopic = Replace(Replace(Replace(Replace(GotTopic," ","&nbsp;"),Chr(34),"&quot;"),">","&gt;"),"<","&lt;") & LableStr
end function

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表