Re: counting pages...
| From: | pete M | Date: | Tue, 27 Apr 2004 11:29:58 +0000 |
| Subject: | Re: counting pages... | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-184748@lists.php.net to get a copy of this message | ||
This is called "pagin"
there are a few links for this
http://www.webdevtips.com/webdevtips/php/paging.php
http://www.phpnoise.com/tutorials/9/1
pedro
Tristan Pretty wrote:
I want to convert my page counter to display just a limited No of page options... Currently, after my database request, I'm getting 1000's of pages... I want to do something like: < < Previous -21 22 23 24 25 26+ Next > > Anyhoo, here's my current code... ================================= if($page > 1){} else { $end_pick = "Next > > "; } ********************************************************************* The information contained in this e-mail message is intended only for the personal and confidential use of the recipient(s) named above. If the reader of this message is not the intended recipient or an agent responsible for delivering it to the intended recipient, you are hereby notified that you have received this document in error and that any review, dissemination, distribution, or copying of this message is strictly prohibited. If you have received this communication in error, please notify us immediately by e-mail, and delete the original message. ***********************************************************************$prev = ($page - 1); $start_pick = "<a href=\"".$_SERVER['PHP_SELF']."?page=$prev\">< < Previous</a> ";} else { $start_pick = "< < Previous "; } for($i = 1; $i <= $total_pages; $i++){if(($page) == $i){ $mid_pick .= "<b>$i</b> "; } else { $mid_pick .= "<a href=\"".$_SERVER['PHP_SELF']."?page=$i\">$i</a> "; }} // Build Next Link if($page < $total_pages){$next = ($page + 1); $end_pick = "<a href=\"".$_SERVER['PHP_SELF']."?page=$next\">Next ></a>";