The number of PHP self-practice items and the pagination effect of text are implemented in the function,
/** * * * @param $_sql * @param $_size*/function_page ($_sql,$_size) { //take out all the variables inside and you can access them externally . Global $_page,$_pagesize,$_pagenum,$_pageabsolute,$_num; if(isset($_get[' Page '])) { $_page=$_get[' Page ']; if(Empty($_page) ||$_page< 0 | | !Is_numeric($_page)) { $_page= 1; } Else { $_page=intval($_page); } } Else { $_page= 1; } $_pagesize=$_size; $_num= _num_rows (_query ($_sql)); if($_num= = 0) { $_pageabsolute= 1; } Else { $_pageabsolute=Ceil($_num/$_pagesize); } if($_page>$_pageabsolute) { $_page=$_pageabsolute; } $_pagenum= ($_page-1) *$_pagesize;}/** * _paging page function * @param $_type * @return return pagination*/function_paging ($_type) { Global $_page,$_pageabsolute,$_num; if($_type= = 1) { Echo''; Echo'
' ; for ( $i= 0; $i< $_pageabsolute; $i+ + ) { if ( $_page = = ( $i+1 )) { Echo '
- $i + 1). ' "Class=" selected ">". ($i+ 1). '
' ; } Else { echo '
- $i + 1). ' " > '. ($i+ 1). '
' ; }} echo '
'; Echo''; } ElseIf($_type= = 2) { Echo''; Echo'
'
;
Echo'
- '. $_page. ' /'. $_pageabsolute. ' Page |
'
;
Echo'
- Total '. $_num. ' A Member |
'
;
if(
$_page= = 1
) {
Echo'
- Home |
'
;
Echo'
- Prev |
'
; }
Else
{
Echo'
- Home |
'
;
Echo'
- $_page-1). ' " > Prev |
'
; }
if(
$_page==
$_pageabsolute
) {
Echo'
- Next Page |
'
;
Echo'
- Last
'
; }
Else
{
Echo'
- $_page+1). ' " > Next Page |
'
;
Echo'
- $_pageabsolute. ' " > Last
'
; }
Echo'
'; Echo''; }}
Wrap the above code in the core library glob.funic.php
You can then simply call the following function in the file:
_pageing function call paging, 1|2,1 for digital paging, 2 for text paging
_paging (2);
?>
http://www.bkjia.com/PHPjc/1038571.html www.bkjia.com true http://www.bkjia.com/PHPjc/1038571.html techarticle PHP Self-Practice the number and text of the page effect is implemented in the function,/* * * * * @param $_sql * @param $_size */function _page ($_sql, $_size) {//will be removed from all variables inside). .