I. some functions require jquery Support 2. the page code is fixed to support automatic queryString retrieval. I usually use $ this-pagination (............) for more information, see www. limian. comtodaywinner, but css is not written by me... wrong. Sorry, not all. Forgive me. If you want css, I Will paste it **
I. some functions require jquery Support 2. the page code is fixed to support automatic queryString retrieval. I usually use $ this-pagination (............) the specific effect can refer to the http://www.limian.com/today/winner but css is not written by me... wrong. Sorry, not all. Forgive me. If you want css, I Will paste it. no /**
1. Some functions require jquery support
2. The page code is fixed to page
Supports automatic queryString retrieval.
I usually use $ this-> pagination (............)
The specific effect can refer to the http://www.limian.com/today/winner
But css is not written by me.
Since css is required, I should paste it. <无>
/*** @ Author: liaoJiangYi * Paging code pagination * @ param $ num int total number of records * @ param $ perpage int how many pieces of data are displayed per page * @ param $ curpage int current page number * @ param $ anchor string URL: & a = 1 & B = 2 * @ param $ page_href_template string example: {url}/invalid pageapps.html */public function pagination ($ num, $ perpage, $ curpage, $ anchor = '', $ page_href_template ='', $ otherJsFunc = '') {$ multipage =''; $ curpage = $ curpage> 1? $ Curpage: 1; if (! Empty ($ _ SERVER ['query _ string']) $ REQUEST_URI = $ _ SERVER ['query _ string']? $ _ SERVER ['php _ SELF '].'? '. $ _ SERVER ['query _ string']: $ _ SERVER ['php _ SELF']; $ mpurl = $ _ SERVER ['request _ URI ']? $ _ SERVER ['request _ URI ']: $ REQUEST_URI; if (! $ Page_href_template) {$ _ parse_url = parse_url ($ mpurl); $ url_query =! Empty ($ _ parse_url ["query"])? $ _ Parse_url ["query"]: ''; if ($ url_query) {$ url_query = explode ('&', $ url_query); $ querys = ''; foreach ($ url_query as $ val) {$ val = explode ('=', $ val); $ k = $ val [0]; $ v = $ val [1]; $ v = htmlspecialchars (strip_tags (trim ($ v), ENT_QUOTES, 'utf-8'); $ k = htmlspecialchars (strip_tags (trim ($ k), ENT_QUOTES, 'utf-8'); $ v = str_replace ("'", '', $ v); $ v = str_replace ('" ', '', $ v ); $ v = str_replace ("\", '', $ v); if ($ K! = 'Page') $ querys. = $ k. '='. $ v. '&';} $ mpurl = $ _ parse_url ['path']. '? '. $ Querys; unset ($ querys, $ v, $ k, $ val);} else $ mpurl. = "? "; Unset ($ url, $ url_query, $ _ parse_url);} else {$ AE = pathinfo ($ mpurl); $ mpurl = $ AE [" dirname "]; unset ($ AE);} if ($ num> $ perpage) {$ page = 5; $ offset = 2; $ pages = @ ceil ($ num/$ perpage ); if ($ page> $ pages) {$ from = 1; $ to = $ pages;} else {$ from = $ curpage-$ offset; $ to = $ curpage + $ page-$ offset-1; if ($ from <1) {$ to = $ curpage + 1-$ from; $ from = 1; if ($ to-$ from) <$ page & ($- $ From) <$ pages) {$ to = $ page ;}} elseif ($ to >$ pages) {$ from = $ curpage-$ pages + $; $ to = $ pages; if ($ to-$ from) <$ page & ($ to-$ from) <$ pages) {$ from = $ pages-$ page + 1 ;}} if (! $ Page_href_template) {$ multipage = ($ curpage-$ offset> 1 & $ pages> $ page? 'Front page': ''). ($ curpage> 1? 'Previous page': ''); for ($ I = $ from; $ I <= $ to; $ I ++) {$ multipage. = $ I = $ curpage? ''. $ I.'': ''. $ I.'';} $ multipage. = ($ curpage! = $ Pages & $ pages> $ page )? '...'. $ Pages. ': ''; $ multipage. = ($ curpage <$ pages? 'Next page': ''). ($ to <$ pages? 'Last page': '');} else {$ mpurl = str_replace ('{url}', $ mpurl, $ page_href_template ); $ multipage = ($ curpage-$ offset> 1 & $ pages> $ page? 'Front page': ''). ($ curpage> 1? '<Previous Page': ''); for ($ I = $ from; $ I <= $ to; $ I ++) {$ multipage. = $ I = $ curpage? ''. $ I.'': ''. $ I.'';} $ multipage. = ($ curpage! = $ Pages & $ pages> $ page )? '...'. $ Pages. '':''; $ multipage. = ($ curpage <$ pages? 'Next page> ': ''). ($ to <$ pages? 'End page': '') ;}$ multipage = $ multipage ;//. 'col '. $ num. 'records are displayed on each page '. $ perpage. 'string'; if ($ otherJsFunc) {$ pages =! Empty ($ pages )? $ Pages: 1; $ pages = $ pages <1? 1: $ pages; $ multipage. = 'Total'. $ pages. 'pagePage';} // $ Multipage =' total '. $ num.' bar '. $ multipage; return $ multipage ;}
/* ------------------------ Pagination ------------------------------*/. p_pages {text-align: right; margin: 25px 0 5px 0; font-family: ' '}. p_pages ,. p_curpage {height: 24px; border: 1px solid # e3e3e3; background: # f8f8f8; color: #666666; display: inline-block; text-align: center; line-height: 25px; min-width: 15px; padding: 0 5px; margin: 0 2px ;}. p_pages. page_select {color: # fff; background: # CC374B; border: 1px solid # cc0004 ;}. p_pages a: hover {color: # cc0004; border: 1px solid # cc0004; background: # fff ;}. p_pages. page_text {width: 34px; height: 16px; border: 1px solid # cccccc; padding: 4px 2px; margin: 0 5px; vertical-align: middle; text-align: center ;}. p_pages. page_btn {width: 50px; height: 26px; background: url ("/cdn/today/images/page_btn.jpg") no-repeat; border: 0; margin: 0 5px; cursor: pointer; vertical-align: middle; margin-right: 18px ;}