杭州设计公司,杭州广告设计公司
实现asp长文章自动分页插件
信息来源:网络     栏目类别: 网页设计     浏览次数:     发表评论 减小字体 增大字体

这是fenye.asp具体代码:

以下是引用片段:

<%
Const maxPagesize=1000 '设置分页字数

Function InsertPageBreak(strText)
Dim strPagebreak,s,ss
Dim i,IsCount,c,iCount,strTemp,Temp_String,Temp_Array
strPagebreak="[hiweb_break]"
s=strText
If Len(s)<maxPagesize Then
InsertPageBreak=s
End If
s=Replace(s, strPagebreak, "")
s=Replace(s, " ", "< >")
s=Replace(s, ">", "<>>")
s=Replace(s, "<", "<<>")
s=Replace(s, """, "<">")
s=Replace(s, "'", "<'>")
If s<>"" and maxPagesize<>0 and InStr(1,s,strPagebreak)=0 then
IsCount=True
Temp_String=""
For i= 1 To Len(s)
c=Mid(s,i,1)
If c="<" Then
IsCount=False
ElseIf c=">" Then
IsCount=True
Else
If IsCount=True Then
If Abs(Asc(c))>255 Then
iCount=iCount+2
Else
iCount=iCount+1
End If
If iCount>=maxPagesize And i<Len(s) Then
strTemp=Left(s,i)
If CheckPagination(strTemp,"table|a|b>|i>|strong|div|span") then
Temp_String=Temp_String & Trim(CStr(i)) & ","
iCount=0
End If
End If
End If
End If
Next
If Len(Temp_String)>1 Then Temp_String=Left(Temp_String,Len(Temp_String)-1)
Temp_Array=Split(Temp_String,",")
For i = UBound(Temp_Array) To LBound(Temp_Array) Step -1
ss = Mid(s,Temp_Array(i)+1)
If Len(ss) > 380 Then
s=Left(s,Temp_Array(i)) & strPagebreak & ss
Else
s=Left(s,Temp_Array(i)) & ss
End If
Next
End If
s=Replace(s, "< >", " ")
s=Replace(s, "<>>", ">")
s=Replace(s, "<<>", "<")
s=Replace(s, "<">", """)
s=Replace(s, "<'>", "'")
InsertPageBreak=s
End Function

Function CheckPagination(strTemp,strFind)
Dim i,n,m_ingBeginNum,m_intEndNum
Dim m_strBegin,m_strEnd,FindArray
strTemp=LCase(strTemp)
strFind=LCase(strFind)
If strTemp<>"" and strFind<>"" then
FindArray=split(strFind,"|")
For i = 0 to Ubound(FindArray)
m_strBegin="<"&FindArray(i)
m_strEnd ="</"&FindArray(i)
n=0
do while instr(n+1,strTemp,m_strBegin)<>0
n=instr(n+1,strTemp,m_strBegin)
m_ingBeginNum=m_ingBeginNum+1
Loop
n=0
do while instr(n+1,strTemp,m_strEnd)<>0
n=instr(n+1,strTemp,m_strEnd)
m_intEndNum=m_intEndNum+1
Loop
If m_intEndNum=m_ingBeginNum then
CheckPagination=True
Else
CheckPagination=False
Exit Function
End If
Next
Else
CheckPagination=False
End If
End Function

Function ContentPagination(hiwebstr)
Dim ContentLen, maxperpage, Paginate
Dim arrContent, strContent, i
Dim m_strFileUrl,m_strFileExt,ArticleID
ArticleID=Request.QueryString("ID")
strContent = InsertPageBreak(hiwebstr)
ContentLen = Len(strContent)
CurrentPage=Request.QueryString("Page")
If CurrentPage="" Then CurrentPage=0
If InStr(strContent, "[hiweb_break]") <= 0 Then
ArticleContent = "<div id=""NewsContentLabel"" class=""NewsContent"">" & strContent & "</div><div id=""Message"" class=""Message""></div>"
Else
arrContent = Split(strContent, "[hiweb_break]")
Paginate = UBound(arrContent) + 1
If CurrentPage = 0 Then
CurrentPage = 1
Else
CurrentPage = CLng(CurrentPage)
End If
If CurrentPage < 1 Then CurrentPage = 1
If CurrentPage > Paginate Then CurrentPage = Paginate
strContent = "<div id=""NewsContentLabel"" class=""NewsContent"">"& arrContent(CurrentPage - 1)

ArticleContent = ArticleContent & strContent
If UserArticle = True Then
ArticleContent = ArticleContent & "</p></div><div id=""Message"" class=""Message""></div><p align=""center""><b>"
Else
ArticleContent = ArticleContent & "</p></div><p align=""center""><b>"
End If
If IsURLRewrite Then
m_strFileUrl = ArticleID & "_"
Else
m_strFileExt = ""
m_strFileUrl = "?id=" & ArticleID & "&Page="
End If
If CurrentPage > 1 Then
If IsURLRewrite And (CurrentPage-1) = 1 Then
ArticleContent = ArticleContent & "<a href="""& ArticleID & m_strFileExt & """>上一页</a> "
Else
ArticleContent = ArticleContent & "<a href="""& m_strFileUrl & CurrentPage - 1 & m_strFileExt & """>上一页</a> "
End If
End If
For i = 1 To Paginate
If i = CurrentPage Then
ArticleContent = ArticleContent & "<font color=""red"">[" & CStr(i) & "]</font> "
Else
If IsURLRewrite And i = 1 Then
ArticleContent = ArticleContent & "<a href="""& ArticleID & m_strFileExt & """>[" & i & "]</a> "
Else
ArticleContent = ArticleContent & "<a href="""& m_strFileUrl & i & m_strFileExt & """>[" & i & "]</a> "
End if
End If
Next
If CurrentPage < Paginate Then
ArticleContent = ArticleContent & " <a href="""& m_strFileUrl & CurrentPage + 1 & m_strFileExt & """>下一页</a>"
End If
ArticleContent = ArticleContent & "</b></p>"
End If
Response.Write(ArticleContent)
End Function
%>

ASP长文章内容自动分页函数

主要功能:自动将长文章内容分页显示,可自由设定分页字数,且不会截断HTML代码。

适用范围:文章内容自动分页插件适用于所有ASP程序。

使用方法:

1.下载附件中的文件,将它解压上传到您的网站根目录

2.在需要分页的页面最顶部调用刚刚上传的文件。调用代码 <!--include file="fenye.asp"-->

3.在内容显示处 将原来的显示代码替换为: <%=ContentPagination(您以前的内容显示变量)%>。

本文标签:分页把本文收藏到 网摘 博采 百度】 其它收藏服务:Yahoo书签 QQ书签 百度搜藏 Del.icio.us Google书签 和讯网摘 天极网摘 添加到饭否 收客网
上一篇:html源码中一组最最精华的代码          回网页设计列表         下一篇:国外绚彩UI设计的web界面欣赏
搜索本站其他内容: 百度一下:[实现asp长文章自动分页插件]   Google搜索:[实现asp长文章自动分页插件]
最新网友评论文章↓
1.sdfsd2008-10-10 12:14:53
2.werewr2008-10-10 12:14:10
3.ewrewr2008-10-10 12:14:00
4.啊2008-10-10 10:54:54
5.第二副图的含义2008-10-10 9:16:47
留言模块加载ing... 设计说明:实现asp长文章自动分页插件平面设计,威迪广告公司为您提供设计欣赏,创意生活,设计欣赏,当代艺术,数字娱乐,平面设计,视觉,平面,fireworks,教程,书籍,封面,设计,标志,广告,作品,图片,下载多元化的信息交流咨询,杭州实现asp长文章自动分页插件视觉引导式的宣传方法让人过目难忘。将光线巧妙地运用在书籍的投影上,视觉,平面,fireworks,教程,封面,设计似乎书籍由内向外透着一股亮光。书上的窗户和灯泡都是设计欣赏将书从平面转换到空间的一个过渡,这些过渡让人们更想探寻亮光后面的另个空间。实现asp长文章自动分页插件平面设计的文化招贴中两本书直接交叉,纯粹的制造出标志,广告,作品,图片,下载一种立体空间感.

文章添加时间:2008-10-15,文件大小:31.15 KB,最近更新时间:2008-10-28 23:25:19 返回TOP↑            

本站文章搜集自网络;共享网络,共享快乐,我为人人,人人为我;如果您知道本站未知来源文章请告知本站谢谢!
文中及留言观点不代表本站;本站转载内容只是为了更好的交流;
若侵犯了您的版权请联系E-mail:有事儿,您Q我!,本站核实后立即处理!

  •             平面设计| 标志设计| 包装设计| 网页设计| 广告设计| VI设计| 画册设计| 专卖店设计| 展位设计| 名片设计| 网站地图|    仅支持IE5及以上1027*768分辨率
  •             友情链接 版权所有 © 威迪广告公司 2008-2010 | TEL:0571-88385993 13296756810 浙ICP备05054324号