How should the paging function of this package be changed as a result of this effect?

Source: Internet
Author: User
I'm not going to show you all the pages. Show only five or 10 page effects How should I change this code?

<?phpfunction Fenye () {global $page, $pagenum;    echo "<div >";    echo "<ul id= ' ul2 ' >"; Echo ' <li> ' $page. '           /'. $pagenum. ' Page |</li> ';             if ($page ==1) {echo ' <li> home |</li> ';           Echo ' <li> prev |</li> '; }else{Echo ' <li><a href= "'. $_server[" Script_name "]. '"             > Home </a>|</li> '; Echo ' <li><a href= '. $_server["Script_name"]. ($page-1). ' "           > Prev </a>|</li> ';           } echo ' <div> ';           Echo ' <ul id= ' ul1 > '; for ($i =0; $i < $pagenum; $i + +) {echo ' <li><a href= "'. $_server[" Script_name "]. '? Page= '. ($i + 1). ' " > '. ($i + 1). '            </a></li> ';           } echo ' </ul> ';           Echo ' </div> ';               if ($page = = $pagenum) {echo ' <li>| next page |</li> ';           Echo ' <li> last |</li> '; }else{Echo ' <li&Gt;|<a href= "'. $_server[" Script_name "]. Page= '. ($page + 1). ' "               > Next </a>|</li> '; Echo ' <li><a href= '. $_server["Script_name"]. Page= '. $pagenum. ' "           > End </a>|</li> ';    } echo ' </ul> ';    Echo ' </div> '; };? >

reply content:

<?php/* Scenario: Continuously update data by updating data that is transferred from the database each time. Premise: You cannot get all the records corresponding SQL statements when you get the data in the database: Select from Tb_name limit ($nowpage-1) $display _page, $display _page//$nowpage Current page//$display _page to show how many pages recommend to see the video of the web (I just learned the page): Http://www.imooc.com/learn/419*/function fenye () {Global $page, $ Pagenum;echo "<div >", echo "<ul id= ' ul2 ' >"; Echo ' <li> '. $page. '       /'. $pagenum. ' Page |</li> ';         if ($page ==1) {echo ' <li> home |</li> ';       Echo ' <li> prev |</li> '; }else{Echo ' <li><a href= "'. $_server[" Script_name "]. '"         > Home </a>|</li> '; Echo ' <li><a href= '. $_server["Script_name"]. Page= '. ($page-1). ' "       > Prev </a>|</li> ';       } echo ' <div> ';       Echo ' <ul id= ' ul1 > '; $fp = ($page-1) * $DP +1;                             $DP How many pages you want to show: for example $DP = 3: First prev 1 2 3 next last;         or $DP = 8: First prev 1 2 3 4 5 6 7 8 Next Last//$FP: Indicates the number of pages to start showing $ep = $fp + $dp; $EP: Indicates the number of pages to end display       for ($i = $fp; $i <= $pagenum; $i + +) {//echo ' <li><a href= "'. $_server[" Script_name "]. '?        Page= '. $i. ' > ' $i. ' </a></li> ';       } echo ' </ul> ';       Echo ' </div> ';           if ($page = = $pagenum) {echo ' <li>| next page |</li> ';       Echo ' <li> last |</li> '; }else{Echo ' <li>|<a href= '. $_server["Script_name"]. '? Page= '. ($page + 1). ' "           > Next </a>|</li> '; Echo ' <li><a href= '. $_server["Script_name"]. Page= '. $pagenum. ' "       > End </a>|</li> '; }echo ' </ul> '; Echo ' </div> ';};? >


The above is how the paging function in this package can be changed as a result of this effect. For more information, please pay attention to topic.alibabacloud.com (www.php.cn)!

  • 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.