ASP分页类(支持多风格变换)(3)


TempStr=Replace(TempStr,"{N1}","首页")
TempStr=Replace(TempStr,"{N2}","上一页")
M="<a href='"&UrlStr&"Page="&CurrPage+1&"'>"&"下一页"&"</a>"
TempStr=Replace(TempStr,"{N3}",M)
M="<a href='"&UrlStr&"Page="&TotalPage&"'>"&"尾页"&"</a>"
TempStr=Replace(TempStr,"{N4}",M)
End If
Else
TempStr=Replace(TempStr,"{N1}","首页")
TempStr=Replace(TempStr,"{N2}","上一页")
TempStr=Replace(TempStr,"{N3}","下一页")
TempStr=Replace(TempStr,"{N4}","尾页")
End If
T=TempStr
T=Replace(T,"{N8}",TotalRecord)
T=Replace(T,"{N6}",TotalPage)
T=Replace(T,"{N5}",CurrPage)
T=Replace(T,"{N7}",PageN)
TempStr=T
StyleA=TempStr
End Function
Private Function StyleB()
'首页 |< 1 2 3 4 5 6 7 >| 尾页
'//标签:{N1} {N2} {L}{N}{L/}{N3}{N4}
If IsEmpty(TempStr) Then
ErrInfo=ErrInfo&"模板为空..."
StyleB=ErrInfo
Exit Function
End If
Dim ForceNum,BackNum'//当前页的前面和后面显示个数
ForceNum=5
BackNum=4
Dim M
'//首页
M="<a href='"&UrlStr&"Page=1'>"&TempB(1)&"</a>"
TempStr=Replace(TempStr,"{N1}",M)
'//尾页
M="<a href='"&UrlStr&"Page="&TempB(6)&"'>"&TempB(4)&"</a>"
TempStr=Replace(TempStr,"{N4}",M)
'//前一页
M="|<"
If CurrPage-1>=1 Then
M="<a href='"&UrlStr&"Page="&CurrPage-1&"'>"&"|<"&"</a>"
End If
TempStr=Replace(TempStr,"{N2}",M)
'//后一页
M=">|"
If CurrPage+1<=TotalPage Then
M="<a href='"&UrlStr&"Page="&CurrPage+1&"'>"&">|"&"</a>"
End If
TempStr=Replace(TempStr,"{N3}",M)
'//取出循环标签
Dim N1,N2,N3,N4,N5,N6
If InStr(TempStr,"{L}")>0 Then
N1=InStr(TempStr,"{L}")
End If
If InStr(TempStr,"{L/}")>0 Then
N2=InStr(TempStr,"{L/}")
End If
If N2<=N1 Then
ErrInfo=ErrInfo&"循环标签出错..."
StyleB=ErrInfo
Exit Function
End If
N3=Mid(TempStr,N1,N2-N1+4)'//储存包括{L}{L/}循环标签的模板
N4=Replace(N3,"{L}","")'//储存不包括{L}{L/}循环标签的模板
N4=Replace(N4,"{L/}","")
'//页码列表
Dim FirstPageNum,LastPageNum
If CurrPage-ForceNum<=1 Then
FirstPageNum=1
PageList=""
Else
FirstPageNum=CurrPage-ForceNum
PageList="... ..."
End If
If CurrPage+BackNum>=TotalPage Then
LastPageNum=TotalPage
PageList_2=""
Else
LastPageNum=CurrPage+BackNum
PageList_2="... ..."
End If
Dim I
For I=FirstPageNum To LastPageNum
If I=CurrPage Then
N5=Replace(N4,"{N}","<b>"&I&"</b>")
N6=N6&N5
Else
M="<a href='"&UrlStr&"Page="&I&"'>"&I&"</a>"
N5=Replace(N4,"{N}",M)
N6=N6&N5
End If
Next
TempStr=Replace(TempStr,N3,N6)
StyleB=TempStr
End Function
Private Function StyleC()
'首页 |< |<< 1 2 3 4 5 6 7 >>| >| 尾页
'//此风格在StyleB的基础上修改,增加两个标签:{N9}上10页 {N10}下10页

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:http://www.heiqu.com/2740.html