PHP paging navigation functions

Source: Internet
Author: User

 

PHP paging navigation functions

 

#*************************************** ******************
# File name: function. php
# Function Description: News addition, modification, and processing module
# Program Production: Print (adleyliu)
# Contact qq: 14339095
# Contact email: [email = adleyliu@163.com] adleyliu@163.com [/email]
# Official Website: [url = http://www.115000.com.cn] http://www.115000.com.cn [/url]
# Copyright (c) 2007-2008 115000.com.cn all rights reserved.
# Last Update:
#*************************************** ******************


#*************************************** ******************
# Paging Functions
#*************************************** ******************
Function yl_list_page ($ pageurl, $ rsnum, $ pages, $ pagecount, $ pagesize ){
# Url
# Total records
# Total number of pages
# Current page number
# Number of entries displayed per page
// $ Pageurl = '? ';
$ Pcount = $ pages;
$ Page_info = '<div class = pagenum> ';
$ Page_info. = '<div class = num> ';
If ($ pcount> 1) & ($ pcount = $ pagecount )){
$ Page_info. = '<a href ='. $ pageurl. 'page = '. intval ($ pagecount-1).'> previous page </a> ';
} Elseif ($ pagecount! = 1) & ($ pcount! = $ Pagecount )){
$ Page_info. = '<a href ='. $ pageurl. 'page = '. intval ($ pagecount-1).'> previous page </a> ';
}
$ Page_info. = '<a href ='. $ pageurl. 'page = 1> top </a> ';
If ($ pagecount> 4 ){
$ Page_info. = '<a href = '. $ pageurl. 'page = 1> [1] </a> <span class = dot>... </span> ';
}
If ($ pcount> $ pagecount + 2 ){
$ Endpage = $ pagecount + 2;
} Else {
$ Endpage = $ pcount;
}
For ($ n = ($ pagecount-2); $ n <= $ endpage; $ n ++ ){
If (! ($ N <1 )){
If ($ n = intval ($ pagecount )){
$ Page_info. = '<span class = normal>'. $ n. '</span> ';
} Else {
$ Page_info. = '<a href ='. $ pageurl. 'page = '. $ n.'> ['. $ n.'] </a> ';
}
}
}
If ($ pagecount + 2 <$ pcount ){
$ Page_info. = '<span class = dot>... </span> <a href = '. $ pageurl. 'page = '. $ pcount. '> ['. $ pcount. '] </a> ';
}
$ Page_info. = '<a href ='. $ pageurl. 'page = '. $ pcount.'> end of the page </a> ';
If ($ pagecount = 1) & ($ pcount! = $ Pagecount) & ($ pcount! = 0 )){
$ Page_info. = '<a href ='. $ pageurl. 'page = '. intval ($ pagecount + 1).'> next page </a> ';
} Else if ($ pagecount! = 1) & ($ pcount! = $ Pagecount )){
$ Page_info. = '<a href ='. $ pageurl. 'page = '. intval ($ pagecount + 1).'> next page </a> ';
}
$ Page_info. = '</div> ';
$ Page_info. = '<div class = pagenum> ';
$ Page_info. = '<div class = num> <span class = normal> total :'. $ rsnum. 'entries /'. $ pcount. 'page /'. $ pagesize. 'entries </span> </div> ';
$ Page_info. = '<div class = num> ';
// Echo '<form name = page action ='. $ pageurl. '> ';
$ Page_info. = 'Go ';
$ Page_info. = '<input type = text name = page value = '1' class = login_left style = 'width: 28px; height: 18px;'> ';
$ Page_info. = 'page <input type = submit name = submit3 class = login_submit style = 'width: 28px; height: 18px; padding-top: 1px; 'onclick = document. myform. action. value = 'go '> ';
// Echo '</form> ';
$ Page_info. = '</div> ';
$ Page_info. = '</div> ';
Return $ page_info;
}

 


CSS style:

 

/* Page */
. Pagenum {
Clear: both; width: '000000'; padding-right: 5px; padding-left: 0px; font-weight: bold; padding-bottom: 0px; overflow: hidden; color: #6396d6; padding-top: 0px; height: 25px;
}
. Pagenum. num {
Float: right;
}
. Pagenum. normal {
Background: # f7fbff; color: #6396d6; float: left; padding-bottom: 2px; margin: 0px 3px 0px 0px; padding-top: 3px; border-left: #6396d6 1px solid; border-right: #6396d6 1px solid; padding-right: 5px; padding-left: 5px; border-top: #6396d6 1px solid; border-bottom: #62.16d6 1px solid;
}
. Pagenum. dot {
Float: left; color: #62.16d6;
}
. Pagenum {
Background: #298ac6; color: # fff; float: left; padding-bottom: 2px; margin: 0px 3px 0px 0px; padding-top: 3px; border-left: #6396d6 1px solid; border-right: #6396d6 1px solid; padding-right: 5px; padding-left: 5px; border-top: #6396d6 1px solid; border-bottom: #62.16d6 1px solid;
}
. Pagenum a: visited {
Color: # fff;
}
. Pagenum a: hover {
Background: # f7fbff; color: #6396d6; border-left: #6396d6 1px solid; border-right: #6396d6 1px solid; border-top: #6396d6 1px solid; border-bottom: #610000d6 1px solid;
}


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.