文章系统自动与手动分页方法的实现.docx

上传人:b****2 文档编号:24462952 上传时间:2023-05-27 格式:DOCX 页数:20 大小:17.14KB
下载 相关 举报
文章系统自动与手动分页方法的实现.docx_第1页
第1页 / 共20页
文章系统自动与手动分页方法的实现.docx_第2页
第2页 / 共20页
文章系统自动与手动分页方法的实现.docx_第3页
第3页 / 共20页
文章系统自动与手动分页方法的实现.docx_第4页
第4页 / 共20页
文章系统自动与手动分页方法的实现.docx_第5页
第5页 / 共20页
点击查看更多>>
下载资源
资源描述

文章系统自动与手动分页方法的实现.docx

《文章系统自动与手动分页方法的实现.docx》由会员分享,可在线阅读,更多相关《文章系统自动与手动分页方法的实现.docx(20页珍藏版)》请在冰豆网上搜索。

文章系统自动与手动分页方法的实现.docx

文章系统自动与手动分页方法的实现

文章系统分页方法的实现:

一、后台添加部分加入“文章分页方式:

1.手动分页2.自动分页3.不分页”,在数据库中写入一个值以判断后台管理员选择的分页方式。

并注明,如果用手动分页方式,在需要分页的地方需插入代码:

“[NextPage]”标记,前台程序以此标记判断手动分页部分文章的分页显示方式。

范例:

1.分页方式:

 不分页  自动  手动注意:

手动方式要输入“[NextPage]”

 

二、前台显示文章部分,先判断后台管理员选择的文章分页方式,如果用户选择的是自动分页,则调用“自动分页部分程序”,选择的是手动分页则调用“手动分页部分程序”。

范例:

1.判断后台管理员发表文章的时候使用的分页方法

判断方法:

(这里以showContent为数据库分页方式字段做例子讲解)

打开数据库后

<%ifrs("showContent")=0then

response.writebbimg(rs("content"))

elseifrs("showContent")=1then

callAutoShow()

elseifrs("showContent")=2then

callFingerShow()

else

response.writebbimg(rs("content"))

endif

%>

判断后台管理员使用的是哪种分页方式,以便调用不同的程序;

其中“AutoShow”为自动分页,“FingerShow”为手动分页方式。

 

2.自动分页:

<%callAutoShow()%>

说明:

此代码将显示文章和文章自动分页的整个过程包含在一个文件内执行,所以在显示文章页面就需要加入以下代码:

--#includefile="inc/page.asp"-->,此代码将显示文章和自动分页的文件包含进去,以执行“Call”语句,调用整个程序过程。

3.手动分页:

<%callFingerShow()%>

说明:

此代码将显示文章和文章自动分页的整个过程包含在一个文件内执行,所以在显示文章页面就需要加入以下代码:

--#includefile="inc/page.asp"-->,此代码将显示文章和自动分页的文件包含进去,以执行“Call”语句,调用整个程序过程。

4.inc目录下page.asp文件的程序代码如下:

(仅供参考)

 

<%

'◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆

'◆过程名:

autoshow◇

'◇功能:

文章内容自动分页◆

'◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇◆◇

ConstShowContentByPage="Yes"'文章内容是否分页显示

ConstMaxPerPage_Content=1000'每页显示大约字符数

subAutoShow()

dimCurrentPage

dimContentLen,MaxPerPage,pages,i,lngBound

dimBeginPoint,EndPoint

'ArticleID=rs("SMT_id")

'strContent=rs("SMT_news")

ContentLen=len(strContent)

CurrentPage=trim(request("page"))

ifShowContentByPage="No"orContentLen<=MaxPerPage_Contentthen

response.write(""&strContent&"")

ifShowContentByPage="Yes"then

response.write"

[1]

"

endif

else

ifCurrentPage=""then

CurrentPage=1

else

CurrentPage=Cint(CurrentPage)

endif

pages=ContentLen\MaxPerPage_Content

ifMaxPerPage_Content*pages

pages=pages+1

endif

lngBound=MaxPerPage_Content'最大误差范围

ifCurrentPage<1thenCurrentPage=1

ifCurrentPage>pagesthenCurrentPage=pages

dimlngTemp

dimlngTemp1,lngTemp1_1,lngTemp1_2,lngTemp1_1_1,lngTemp1_1_2,lngTemp1_1_3,lngTemp1_2_1,lngTemp1_2_2,lngTemp1_2_3

dimlngTemp2,lngTemp2_1,lngTemp2_2,lngTemp2_1_1,lngTemp2_1_2,lngTemp2_2_1,lngTemp2_2_2

dimlngTemp3,lngTemp3_1,lngTemp3_2,lngTemp3_1_1,lngTemp3_1_2,lngTemp3_2_1,lngTemp3_2_2

dimlngTemp4,lngTemp4_1,lngTemp4_2,lngTemp4_1_1,lngTemp4_1_2,lngTemp4_2_1,lngTemp4_2_2

dimlngTemp5,lngTemp5_1,lngTemp5_2

dimlngTemp6,lngTemp6_1,lngTemp6_2

ifCurrentPage=1then

BeginPoint=1

else

BeginPoint=MaxPerPage_Content*(CurrentPage-1)+1

lngTemp1_1_1=instr(BeginPoint,strContent,"",1)

lngTemp1_1_2=instr(BeginPoint,strContent,"",1)

lngTemp1_1_3=instr(BeginPoint,strContent,"",1)

iflngTemp1_1_1>0then

lngTemp1_1=lngTemp1_1_1

elseiflngTemp1_1_2>0then

lngTemp1_1=lngTemp1_1_2

elseiflngTemp1_1_3>0then

lngTemp1_1=lngTemp1_1_3

else

lngTemp1_1=0

endif

lngTemp1_2_1=instr(BeginPoint,strContent,"

lngTemp1_2_2=instr(BeginPoint,strContent,"

lngTemp1_2_3=instr(BeginPoint,strContent,"

iflngTemp1_2_1>0then

lngTemp1_2=lngTemp1_2_1

elseiflngTemp1_2_2>0then

lngTemp1_2=lngTemp1_2_2

elseiflngTemp1_2_3>0then

lngTemp1_2=lngTemp1_2_3

else

lngTemp1_2=0

endif

iflngTemp1_1=0andlngTemp1_2=0then

lngTemp1=BeginPoint

else

iflngTemp1_1>lngTemp1_2then

lngtemp1=lngTemp1_2

else

lngTemp1=lngTemp1_1+8

endif

endif

lngTemp2_1_1=instr(BeginPoint,strContent,"

",1)

lngTemp2_1_2=instr(BeginPoint,strContent,"

",1)

iflngTemp2_1_1>0then

lngTemp2_1=lngTemp2_1_1

elseiflngTemp2_1_2>0then

lngTemp2_1=lngTemp2_1_2

else

lngTemp2_1=0

endif

lngTemp2_2_1=instr(BeginPoint,strContent,"

lngTemp2_2_2=instr(BeginPoint,strContent,"

iflngTemp2_2_1>0then

lngTemp2_2=lngTemp2_2_1

elseiflngTemp2_2_2>0then

lngTemp2_2=lngTemp2_2_2

else

lngTemp2_2=0

endif

iflngTemp2_1=0andlngTemp2_2=0then

lngTemp2=BeginPoint

else

iflngTemp2_1>lngTemp2_2then

lngtemp2=lngTemp2_2

else

lngTemp2=lngTemp2_1+4

endif

endif

lngTemp3_1_1=instr(BeginPoint,strContent,"",1)

lngTemp3_1_2=instr(BeginPoint,strContent,"",1)

iflngTemp3_1_1>0then

lngTemp3_1=lngTemp3_1_1

elseiflngTemp3_1_2>0then

lngTemp3_1=lngTemp3_1_2

else

lngTemp3_1=0

endif

lngTemp3_2_1=instr(BeginPoint,strContent,"

lngTemp3_2_2=instr(BeginPoint,strContent,"

iflngTemp3_2_1>0then

lngTemp3_2=lngTemp3_2_1

elseiflngTemp3_2_2>0then

lngTemp3_2=lngTemp3_2_2

else

lngTemp3_2=0

endif

iflngTemp3_1=0andlngTemp3_2=0then

lngTemp3=BeginPoint

else

iflngTemp3_1>lngTemp3_2then

lngtemp3=lngTemp3_2

else

lngTemp3=lngTemp3_1+5

endif

endif

iflngTemp1

lngTemp=lngTemp2

else

lngTemp=lngTemp1

endif

iflngTemp

lngTemp=lngTemp3

endif

iflngTemp>BeginPointandlngTemp<=BeginPoint+lngBoundthen

BeginPoint=lngTemp

else

lngTemp4_1_1=instr(BeginPoint,strContent,"",1)

lngTemp4_1_2=instr(BeginPoint,strContent,"",1)

iflngTemp4_1_1>0then

lngTemp4_1=lngTemp4_1_1

elseiflngTemp4_1_2>0then

lngTemp4_1=lngTemp4_1_2

else

lngTemp4_1=0

endif

lngTemp4_2_1=instr(BeginPoint,strContent,"

lngTemp4_2_1=instr(BeginPoint,strContent,"

iflngTemp4_2_1>0then

lngTemp4_2=lngTemp4_2_1

elseiflngTemp4_2_2>0then

lngTemp4_2=lngTemp4_2_2

else

lngTemp4_2=0

endif

iflngTemp4_1=0andlngTemp4_2=0then

lngTemp4=BeginPoint

else

iflngTemp4_1>lngTemp4_2then

lngtemp4=lngTemp4_2

else

lngTemp4=lngTemp4_1+5

endif

endif

iflngTemp4>BeginPointandlngTemp4<=BeginPoint+lngBoundthen

BeginPoint=lngTemp4

else

lngTemp5_1=instr(BeginPoint,strContent,"

lngTemp5_2=instr(BeginPoint,strContent,"

iflngTemp5_1>0then

lngTemp5=lngTemp5_1

elseiflngTemp5_2>0then

lngTemp5=lngTemp5_2

else

lngTemp5=BeginPoint

endif

iflngTemp5>BeginPointandlngTemp5

BeginPoint=lngTemp5

else

lngTemp6_1=instr(BeginPoint,strContent,"
",1)

lngTemp6_2=instr(BeginPoint,strContent,"
",1)

iflngTemp6_1>0then

lngTemp6=lngTemp6_1

elseiflngTemp6_2>0then

lngTemp6=lngTemp6_2

else

lngTemp6=0

endif

iflngTemp6>BeginPointandlngTemp6

BeginPoint=lngTemp6+4

endif

endif

endif

endif

endif

ifCurrentPage=pagesthen

EndPoint=ContentLen

else

EndPoint=MaxPerPage_Content*CurrentPage

ifEndPoint>=ContentLenthen

EndPoint=ContentLen

else

lngTemp1_1_1=instr(EndPoint,strContent,"",1)

lngTemp1_1_2=instr(EndPoint,strContent,"",1)

lngTemp1_1_3=instr(EndPoint,strContent,"",1)

iflngTemp1_1_1>0then

lngTemp1_1=lngTemp1_1_1

elseiflngTemp1_1_2>0then

lngTemp1_1=lngTemp1_1_2

elseiflngTemp1_1_3>0then

lngTemp1_1=lngTemp1_1_3

else

lngTemp1_1=0

endif

lngTemp1_2_1=instr(EndPoint,strContent,"

lngTemp1_2_2=instr(EndPoint,strContent,"

lngTemp1_2_3=instr(EndPoint,strContent,"

iflngTemp1_2_1>0then

lngTemp1_2=lngTemp1_2_1

elseiflngTemp1_2_2>0then

lngTemp1_2=lngTemp1_2_2

elseiflngTemp1_2_3>0then

lngTemp1_2=lngTemp1_2_3

else

lngTemp1_2=0

endif

iflngTemp1_1=0andlngTemp1_2=0then

lngTemp1=EndPoint

else

iflngTemp1_1>lngTemp1_2then

lngtemp1=lngTemp1_2-1

else

lngTemp1=lngTemp1_1+7

endif

endif

lngTemp2_1_1=instr(EndPoint,strContent,"

",1)

lngTemp2_1_2=instr(EndPoint,strContent,"

",1)

iflngTemp2_1_1>0then

lngTemp2_1=lngTemp2_1_1

elseiflngTemp2_1_2>0then

lngTemp2_1=lngTemp2_1_2

else

lngTemp2_1=0

endif

lngTemp2_2_1=instr(EndPoint,strContent,"

lngTemp2_2_2=instr(EndPoint,strContent,"

iflngTemp2_2_1>0then

lngTemp2_2=lngTemp2_2_1

elseiflngTemp2_2_2>0then

lngTemp2_2=lngTemp2_2_2

else

lngTemp2_2=0

endif

iflngTemp2_1=0andlngTemp2_2=0then

lngTemp2=EndPoint

else

iflngTemp2_1>lngTemp2_2then

lngTemp2=lngTemp2_2-1

else

lngTemp2=lngTemp2_1+3

endif

endif

lngTemp3_1_1=instr(EndPoint,strContent,"",1)

lngTemp3_1_2=instr(EndPoint,strContent,"",1)

iflngTemp3_1_1>0then

lngTemp3_1=lngTemp3_1_1

elseiflngTemp3_1_2>0then

lngTemp3_1=lngTemp3_1_2

else

lngTemp3_1=0

endif

lngTemp3_2_1=instr(EndPoint,strContent,"

lngTemp3_2_2=instr(EndPoint,strContent,"

iflngTemp3_2_1>0then

lngTemp3_2=lngTemp3_2_1

elseiflngTemp3_2_2>0then

lngTemp3_2=lngTemp3_2_2

else

lngTemp3_2=0

endif

iflngTemp3_1=0andlngTemp3_2=0then

lngTemp3=EndPoint

else

iflngTemp3_1>lngTemp3_2then

lngtemp3=lngTemp3_2-1

else

lngTemp3=lngTemp3_1+4

endif

endif

iflngTemp1

lngTemp=lngTemp2

else

lngTemp=lngTemp1

endif

iflngTemp

lngTemp=lngTemp3

endif

iflngTemp>EndPointandlngTemp<=EndPoint+lngBoundthen

EndPoint=lngTemp

else

lngTemp4_1_1=instr(EndPoint,strContent,"",1)

lngTemp4_1_2=instr(EndPoint,strContent,"",1)

iflngTemp4_1_1>0then

lngTemp4_1=lngTemp4_1_1

elseiflngTemp4_1_2>0then

lngTemp4_1=lngTemp4_1_2

else

lngTemp4_1=0

endif

lngTemp4_2_1=instr(EndPoint,strContent,"

lngTemp4_2_1=instr(EndPoint,strContent,"

iflngTemp4_2_1>0then

lngTemp4_2=lngTemp4_2_1

elseiflngTemp4_2_2>0then

lngTemp4_2=lngTemp4_2_2

else

lngTemp4_2=0

endif

iflngTemp4_1=0andlngTemp4_2=0then

lngTemp4=EndPoint

else

iflngTemp4_1>lngTemp4_2then

lngtemp4=lngTemp4_2-1

else

lngTemp4=lngTemp4_1+4

endif

endif

iflngTemp4>EndPointandlngTemp4<=EndPoint+lngBoundthen

EndPoint=lngTemp4

else

lngTemp5_1=instr(EndPoint,strContent,"

lngTemp5_2=instr(EndPoint,strContent,"

iflngTemp5_1>0then

lngTemp5=lngTemp5_1-1

elseiflngTemp5_2>0then

lngTemp5=lngTemp5_2-1

else

lngTemp5=EndPoint

endif

iflngTemp5>EndPointandlngTemp5

EndP

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 高等教育 > 法学

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1