'************************************************
'函数文件
'************************************************
'该函数只是用来从一个记录编号id返回一个以0开头的字符串
'比如id=12,将返回字符串000000012
Function GetFatherCode(id)
Dim numTemp
numTemp=1000000000+id
GetFatherCode=Mid(Cstr(numTemp),2) & "/"
End Function
'该函数用来返回记录编号 id 对应的father_id字段值
'一般用来返回父文章的father_id字段值
Function getFather(id)
dim rs,strSql
strSql="Select father_id From bbs Where id=" & id
Set rs=db.Execute(strSql)
getFather=rs("father_id")
End Function
'该函数用来在标题前显示前导符号和空格
Function viewnull(father_id)
Dim I,numTemp,strNull
'因为每一层都是10个字符,如000000108/,所以numTemp会返回总共多少层
numTemp=Len(father_id)/10
If numTemp=1 Then
strNull="● "
Else
For I=1 To numTemp
strNull=strNull & " "
Next
strNull=strNull & "○ "
End If
viewnull=strNull '返回函数值
End Function
'该函数用来处理客户提交的文本
Function myReplace(myString)
myString=Replace(myString,"&","&") '替换&为字符实体&
myString=Replace(myString," myString=Replace(myString,">",">") '替换>
myString=Replace(myString,chr(13),"") '替换回车符
myString=Replace(myString,chr(32)," ") '替换空格符
myString=Replace(myString,chr(9)," ") '替换Tab缩进符
myString=Replace(myString,chr(39),"´") '替换单引号
myString=Replace(myString,chr(34),""") '替换双引号
myReplace=myString '返回函数值
End Function
'该函数用来求出当前显示页码的最小值
Function minPage(page_no,page_total)
Dim numTemp
numTemp=(int((page_no-1)/10))*10+1
minPage=numTemp
End Function
'该函数用来求出当前显示页码的最大值
Function maxPage(page_no,page_total)
Dim numTemp
numTemp=(int((page_no-1)/10))*10+10
If numTemp>page_total Then
numTemp=page_total
End If
maxPage=numTemp
End Function
'该函数用来从若干个关键词中返回查找条件
Function condition(keyword,filed)
'这里的keyword其实是由空格隔开的多个关键字组成的,首先将其拆分成一个数组
Dim arrKeyword,numKeyword,I
arrKeyword=Split(keyword," ") 'split函数会把keyword拆分成一个数组
numKeyword=Ubound(arrkeyword) '返回数组的最大下标,因为从0开始,所以关键词个数为numKeyword+1
'下面开始组织这个条件,依次添加多个关键词
For I=0 To numKeyword
condition=condition & " And " & field & " like '%" & arrKeyword(I) & "%'"
Next
End Function
%>