Re: Algorithm: Limiting Large Numbers of Pages to 10 visible
| From: | Dimitris Kossikidis | Date: | Fri, 21 Dec 2001 10:30:27 +0000 |
| Subject: | Re: Algorithm: Limiting Large Numbers of Pages to 10 visible | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-78439@lists.php.net to get a copy of this message | ||
Or you can use this simply class from Manuel Lemos's site. It works with
Mysql only.
http://phpclasses.upperdesign.com/browse.html/package/366
> Hi,
>
> I need an algorithm for paging. If I have 100 pages of results, I only
> want to show
> << Prev 1 2 3 4 5 6 7 8 9 10 Next >>
>
> Where I limit the number to 10 results of pages, but I cannot figure it
out
> for the life of me.
> for ($i = $page; $i <= ($page+10); $i++) {
> if ($i != $page) {
> echo " <a href=\"$PHP_SELF?catid=$catid&page=$i\">$i</a>
> ";
> } else {
> echo " $i ";
> }
>
> }
> echo " <a
> href=\"$PHP_SELF?catid=$catid&page=$i\">>></a> ";
> echo " <a
> href=\"$PHP_SELF?catid=$catid&page=$num_pages\">End</a>
";
> }
>
>
>
> But what I need to do is not show pages that aren't there, and I'm
> hardwiring it to show
> 10 whether they exist or not.
>
> I've got to believe that there's a really slick way of doing this. I've
> searched the usual
> places (weberdev.com, devshed.com, zend.com) but there's no really good
> keywords,
> and when you search on 'paging" you get too many results to be useful
>
> Thanks in advance,
> Lara
> ---------------------
> Lara J. Fabans
> Lodestone Software, Inc
> lara@lodestone-sw.com
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>