Re: Re: counting pages...

From: Date: Tue, 27 Apr 2004 11:32:49 +0000
Subject: Re: Re: counting pages...
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-184749@lists.php.net to get a copy of this message
These only appear to do what I've got already... I don't want to have 1000's of page number on my page. I simply want to have say 5 pages either side of my current page displayed. Like this: http://www.google.co.uk/search?q=dream&hl=en&lr=&ie=UTF-8&oe=UTF-8&start=240&sa=N (look at teh bottom nav links... they don't start at No 1...) pete M <pmorgan@ukds.net> 27/04/2004 12:29 To php-general@lists.php.net cc Subject [PHP] Re: counting pages... 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){ > $prev = ($page - 1); > $start_pick = "<a > href=\"".$_SERVER['PHP_SELF']."?page=$prev\">< < > Previous</a>&nbsp;"; > } else { > $start_pick = "< < Previous&nbsp;"; > } > > for($i = 1; $i <= $total_pages; $i++){ > if(($page) == $i){ > $mid_pick .= "<b>$i</b>&nbsp;"; > } else { > $mid_pick .= "<a > > href=\"".$_SERVER['PHP_SELF']."?page=$i\">$i</a>&nbsp;"; > } > } > > // 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 > >&nbsp;"; > } > > > > > > ********************************************************************* > 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. > *********************************************************************** > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php ********************************************************************* 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. ***********************************************************************

« previous php.general (#184749) next »