【www.gdgbn.com--php函数】
- <% "==============================================
- "函数名:contentpage "作 用:内容分页
- "参 数:1、ocontent ----- 文章内容 " 2、olink ----- 链接
- "整 理:www.asp教程program.cn "原创文章,转载请保留此信息,谢谢
- "==============================================
- function contentpage(ocontent, olink) dim outstr, arrcontent, nextpage, arrpage
- if instr(ocontent, "[nextpage]") <= 0 then outstr = ocontent
- else nextpage = request("nextpage")
- arrcontent = split(ocontent, "[nextpage]") arrpage = ubound(arrcontent) + 1
- if (nextpage = "" or isnull(nextpage) or not isnumeric(nextpage)) then nextpage = 1
- else nextpage = cint(nextpage)
- end if if nextpage < 1 then
- nextpage = 1 end if
- if nextpage > arrpage then nextpage = arrpage
- end if outstr = arrcontent(nextpage - 1)
- outstr = outstr "
" for iii = 1 to arrpage - if iii = nextpage then outstr = outstr ""&iii" "
- else outstr = outstr """&olink"nextpage="&iii""">"&iii" "
- end if next
- end if contentpage = outstr
- end function
- "=================demo================== dim sstrhtml, ostrhtml
- sstrhtml = "我的名字叫胡浪[nextpage]胡是古月的胡[nextpage]浪是三点水一个良字的浪[nextpage]不是一个帅哥哦[nextpage]很普通的一个人" ostrhtml = "我的名字叫胡浪,胡是古月的胡,浪是三点水一个良字的浪,不是一个帅哥哦,很普通的一个人"
- "=================demo================== response.write("------------------- 带分页 ---------------------")
- response.write("
") response.write(contentpage(sstrhtml, "?")) - response.write("
") response.write("------------------- 不带分页 ---------------------") - response.write("
") response.write(contentpage(ostrhtml, "?")) - %>