麻辣堂|资源主站|开发论坛|在线手册
首页 Apache Linux Java MySQL 注册帮助 
PHP项目开发组是PHP开发资源网于2007组年建成立的项目开发团队,目前核心开发成员有27人, 项目协作成员8名.下设7个开发组,主要承接大/中型网站项目开发任务。

    由于开发任务较多,人员比较紧张,现面向社会招聘全职或者兼职开发人员,不管你是在校大学生,还是全职开发人员,以及SOHO都可以联系本站,我们可以长期合作,并为您带来丰厚的报酬。
  您现在的位置:PHP开发资源网 > 麻辣堂 > 详细资料
待解决
asp分页类
悬赏分:20 - 2007年08月14日

[php] <% '===================================================================== 'XDOWNPAGE ASP版本 ' '===================================================================== Const Btn_First="【首页】" '定义第一页按钮显示样式 Const Btn_Prev="【上页】" '定义前一页按钮显示样式 Const Btn_Next="【下页】" '定义下一页按钮显示样式 Const Btn_Last="【尾页】" '定义最后一页按钮显示样式 Const XD_Align="center" '定义分页信息对齐方式 Const XD_Width="100%" '定义分页信息框大小 Class Page Private XD_PageCount,XD_Conn,XD_Rs,XD_SQL,XD_PageSize,Str_errors,int_curpage,str_URL,int_totalPage,int_totalRecord '================================================================= 'PageSize 属性 '设置每一页的分页大小 '================================================================= Public Property Let PageSize(int_PageSize) If IsNumeric(Int_Pagesize) Then XD_PageSize=CLng(int_PageSize) Else str_error=str_error & "PageSize的参数不正确" ShowError() End If End Property Public Property Get PageSize If XD_PageSize="" or (not(IsNumeric(XD_PageSize))) Then PageSize=10 Else PageSize=XD_PageSize End If End Property '================================================================= 'GetRS 属性 '返回分页后的记录集 '================================================================= Public Property Get GetRs() Set XD_Rs=Server.createobject("adodb.recordset") XD_Rs.PageSize=PageSize XD_Rs.Open XD_SQL,XD_Conn,1,1 If not(XD_Rs.eof and XD_RS.BOF) Then If int_curpage>XD_RS.PageCount Then int_curpage=XD_RS.PageCount End If XD_Rs.AbsolutePage=int_curpage End If Set GetRs=XD_RS End Property '================================================================ 'GetConn 得到数据库连接 ' '================================================================ Public Property Let GetConn(obj_Conn) Set XD_Conn=obj_Conn End Property '================================================================ 'GetSQL 得到查询语句 ' '================================================================ Public Property Let GetSQL(str_sql) XD_SQL=str_sql End Property '================================================================== 'Class_Initialize 类的初始化 '初始化当前页的值 ' '================================================================== Private Sub Class_Initialize '======================== '设定一些参数的黙认值 '======================== XD_PageSize=10 '设定分页的默认值为10 '======================== '获取当前面的值 '======================== If request("page")="" Then int_curpage=1 ElseIf not(IsNumeric(request("page"))) Then int_curpage=1 ElseIf CInt(Trim(request("page")))<1 Then int_curpage=1 Else Int_curpage=CInt(Trim(request("page"))) End If End Sub '==================================================================== 'ShowPage 创建分页导航条 '有首页、前一页、下一页、末页、还有数字导航 ' '==================================================================== Public Sub ShowPage() Dim str_tmp int_totalRecord=XD_RS.RecordCount If int_totalRecord<=0 Then str_error=str_error & "总记录数为零,请输入数据" Call ShowError() End If If int_totalRecordint_Totalpage Then int_curpage=int_TotalPage End If '=============================================================================== '显示分页信息,各个模块根据自己要求更改显求位置 '=============================================================================== response.write "
" str_tmp=ShowFirstPrv response.write str_tmp str_tmp=showNumBtn 'response.write str_tmp str_tmp=ShowNextLast response.write str_tmp str_tmp=ShowPageInfo response.write str_tmp response.write "
" End Sub '============================ '取得开始位置 '============================ Private Function getStart() dim intStart intStart = 0 do while int_curpage>0 If(int_curpage = 1) Then intStart = int_curpage exit do End if If(Right(CStr(int_curpage),1) = 0) Then intStart = int_curpage exit do End if int_curpage = int_curpage-1 loop getStart = intStart End Function '============================ '取得结束位置 '============================ private Function getEnd() dim intEnd intEnd = 0 int_totalRecord=XD_RS.RecordCount If int_totalRecord 1) Then int_prvpage=int_start-1 showStr = showStr&"97..." Else showStr = showStr&"97" End if For i= int_start to int_end If(i = int_curpage) Then showStr = showStr& "["&i&"] " Else 'response.Write(int_curpage) showStr = showStr& ""&i&" " End if Next 'response.Write(int_totalpage) If(CInt(int_end)8:" Else showStr = showStr&"8:" End if response.write "
" response.Write(showStr&" ") str_tmp=ShowPageInfo response.write str_tmp str_tmp=showJumpPage response.Write(str_tmp) response.write "
" End Sub '==================================================================== 'ShowFirstPrv 显示首页、前一页 ' ' '==================================================================== Private Function ShowFirstPrv() Dim Str_tmp,int_prvpage If int_curpage=1 Then str_tmp=Btn_First&" "&Btn_Prev Else int_prvpage=int_curpage-1 str_tmp=""&Btn_First&" "& Btn_Prev&"" End If ShowFirstPrv=str_tmp End Function '==================================================================== 'ShowNextLast 下一页、末页 ' ' '==================================================================== Private Function ShowNextLast() Dim str_tmp,int_Nextpage If Int_curpage>=int_totalpage Then str_tmp=Btn_Next & " " & Btn_Last Else Int_NextPage=int_curpage+1 str_tmp=""&Btn_Next&" "& Btn_Last&"" End If ShowNextLast=str_tmp End Function '==================================================================== 'ShowNumBtn 数字导航 ' ' '==================================================================== Private Function showNumBtn() Dim i,str_tmp For i=1 to int_totalpage str_tmp=str_tmp & "["&i&"] " Next showNumBtn=str_tmp End Function '==================================================================== 'ShowPageInfo 分页信息 '更据要求自行修改 ' '==================================================================== Private Function ShowPageInfo() Dim str_tmp str_tmp="【第"&int_curpage&"/"&int_totalpage&"页】 【共"&int_totalrecord&"条记录】 【每页"&XD_PageSize&"条】" ShowPageInfo=str_tmp End Function '============================ '数字跳转框 '============================ private Function showJumpPage() dim i,str_tmp str_tmp = "【转到" str_tmp = str_tmp & "】" showJumpPage = str_tmp End Function '================================================================== 'GetURL 得到当前的URL '更据URL参数不同,获取不同的结果 ' '================================================================== Private Function GetURL() Dim strurl,str_url,i,j,search_str,result_url search_str="page=" strurl=Request.ServerVariables("URL") Strurl=split(strurl,"/") i=UBound(strurl,1) str_url=strurl(i)'得到当前页文件名 str_params=Request.ServerVariables("QUERY_STRING") If str_params="" Then result_url=str_url & "?page=" Else If InstrRev(str_params,search_str)=0 Then result_url=str_url & "?" & str_params &"&page=" Else j=InstrRev(str_params,search_str)-2 If j=-1 Then result_url=str_url & "?page=" Else str_params=Left(str_params,j) result_url=str_url & "?" & str_params &"&page=" End If End If End If GetURL=result_url End Function '==================================================================== ' 设置 Terminate 事件。 ' '==================================================================== Private Sub Class_Terminate XD_RS.close Set XD_RS=nothing End Sub '==================================================================== 'ShowError 错误提示 ' ' '==================================================================== Private Sub ShowError() If str_Error <> "" Then Response.Write("
" & SW_Error & "
") Response.End End If End Sub End class %> [/php]

提问者:冬冬   08-14 08:08
答复
路过。。。顺便帮顶:)
回答者:玉米づ冰冻可乐 - 瓦岗村民 8-22 09:10
我也来回答:
不管你有没有帮助我们,瓦岗寨8万村民将感谢你。。。。。

为防止灌水,您需要计算一道数学题: 答案:
77 + 46 = ? 请将计算结果填在上面

 
[]
©2007 PhpRes.COM