counting pages...
| From: | Tristan dot Pretty at risk dot sungard dot com | Date: | Tue, 27 Apr 2004 11:03:34 +0000 |
| Subject: | counting pages... | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-184746@lists.php.net to get a copy of this message | ||
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){
$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>";
} 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.
***********************************************************************