Self-beautifying paging code sharing

Source: Internet
Author: User
Provides various official and user-released code examples and code reference. You are welcome to share and learn your own beautifying paging code.

First look at the effect

Code Section: // Set paging Query

$ Data = M ('Think. huodong_fenlei'); // instantiate a Data Object
Import ('org. Util. page'); // import the paging class
$ Count = $ Data-> where ($ map)-> count (); // query the total number of records meeting the requirements
$ Page = new Page ($ count, 1); // The total number of incoming records of the instantiated Page class and 5 records are displayed on each Page
$ NowPage = isset ($ _ GET ['P'])? $ _ GET ['P']: 1;
$ List = $ Data-> where ($ map)-> order ('addtime desc')-> page ($ nowPage. ','. $ Page-> listRows)-> select ();
$ Show = $ Page-> show (); // display the output by Page
$ This-> assign ('page', $ show); // value-assigned paging output
$ This-> assign ('LIST', $ list); // assign a value to a dataset
$ This-> display ();
CSS Section .result.page {
height: 40px;
width: auto;
text-align: center;
line-height: 40px;
padding-right: 30px;
padding-left: 30px;
margin: 15px auto 30px;

}

.result.page a {
height: 25px;
width: auto;
display: inline-block;
color: #333;
border: 1px solid #CCC;
text-decoration: none;
line-height: 25px;
padding-left: 5px;
padding-right: 5px;
background-color: #F9F9F9;
}
.result.page .current {
height: 25px;
width: auto;
padding-left: 8px;
padding-right: 8px;
line-height: 25px;
display: inline-block;
background-color: #09F;
color: #FFF;
}
.result.page a:hover {
background-color: #09F;
color:#FFF;
border: 1px solid #09F;
}

Page.zip (8.4 KB download: 118 times)

AD: truly free, domain name + VM + enterprise mailbox = 0 RMB

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.