Javascript automatically converts ThinkPHP pagination to bootstrap pagination and thinkphpbootstrap
# Write a common paging HTML generated by thinkphp, which is automatically converted to bootstrap pagination:
/*** @ Author default7 # zbphp.com * @ description converts ThinkPHP pages to bootstrap pages * @ param selector */function initPagination (selector) {selector = selector | '. page '; $ (selector ). each (function (I, o) {var html = '<ul class = "pagination">'; $ (o ). find ('a, span '). each (function (i2, o2) {var linkHtml = ''; if ($ (o2 ). is ('A') {linkHtml = '<a href = "' + ($ (o2 ). attr ('href ') |' # ') +' "> '+ $(o2 ). text () + '</a>';} else if ($ (o2 ). is ('span ') {linkHtml =' <a> '+ $(o2 ). text () + '</a>';} var css = ''; if ($ (o2 ). hasClass ('current') {css = 'class = "active "';} html + = '<li' + css + '>' + linkHtml + '</li>';}); html + = '</ul> '; authorization (o).html (html ). fadeIn ();});}
How to change the page pages and THINKPHP kernel, for example, http: // wwwttplmgcom/special/8 html
Use the setConfig method in the paging class to customize the paging style:
I have a previously used custom paging class. Let's change it.
/***** Enter public paging class * @ param array $ map paging filter condition * @ param class $ Form data model * @ param integer $ number of lines displayed on the limit page * @ param string $ order sorting * @ return array */public function _ list ($ map, $ Form, $ limit = 9, $ order = 'add _ Time') {$ res = array (); $ p = empty ($ _ GET ['P'])? 0: (int) $ _ GET ['P']; $ res ['LIST'] = $ Form-> field (true)-> where ($ map) -> order ($ order)-> page ($ p. ','. $ limit)-> select (); import ('org. util. page '); // import the paging class $ count = $ Form-> where ($ map)-> count (); // query the total number of records meeting the requirements $ Page = new Page ($ count, $ limit ); // The total number of incoming records and the number of records displayed on each Page in the instantiated paging class $ Page-> rollPage = 3; $ Page-> setConfig ('Theme ', "% upPage % linkPage % downPage % <li style = 'width: 50px; '> <a href = 'javascript: void (0) '> % nowPage %/% totalPage % page </a> </li> "); $ res ['page'] = $ Page-> show (); // return $ res ;}
The bootstrap effect cannot be displayed after the display template in thinkphp
Brother, is your path correct? Create a Publuc folder under the project folder and change it to the absolute path. Replace the path with the ThinkPHP template constant _ PUBLIC _.