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