Re: DB Pager: Many pages, many links

From: Date: Wed, 07 Nov 2001 20:55:32 +0000
Subject: Re: DB Pager: Many pages, many links
References: 1 2  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-481@lists.php.net to get a copy of this message
For the second time on this newsgroup, I find the solution only a short time after asking! And after hours thinking about it! You people are amazing, you only think on the problem and it solves by itself :-))) Here's what I did: foreach ($data['pages'] as $page => $start_row) { if ((($data['current'] - 10) <= $page) && (($data['current'] + 10) >= $page)) { ?> <a href="index.php?from=<?php echo $start_row; ?>"><?php echo $page; ?></a> <?php } } 10 above, inside the if (), it's is the number of direct page links you want on each side of the current. Left 10, ten pages on the left side. Right 10, ten links on the right side. Again, thanks very much. -- Julio Nobrega A hora está chegando: http://toca.sourceforge.net "Julio Nobrega Trabalhando" <inerteARROBAhotmail.com@pb1.pair.com> wrote in message news:20011107202741.81800.qmail@pb1.pair.com... > Just a small correction, where it reads ..."So page 23 would show links > from 13 to > 23, but no... "... Should be from 13 to 33... > > -- > > Julio Nobrega > > A hora está chegando: > http://toca.sourceforge.net > "Julio Nobrega Trabalhando" <inerteARROBAhotmail.com@pb1.pair.com> wrote in > message news:20011107201223.72469.qmail@pb1.pair.com... > > Hi All! > > > > I am currently using the DB Pager to make pages of 2524 records stored > on > > my database. > > > > There's a foreach that produces a direct link to the pages, listing > their > > numbers. So: > > > > 1 2 3 4 5 6 7 > > > > 1 has a link to show the first 10 records, 2 to show the next 10, 3 to > > show between 20 and 30, and so on... > > > > But with 2524 records, that's 253 pages, 253 links! > > > > I tried to make something like google results where just the aproximate > > (spelling on that?) pages are show. So page 23 would show links from 13 to > > 23, but no... I could not do it. > > > > Anyway you people imagine? If you wish, describe it abstracly and I will > > code it and publish here, either way, that would be something cool to have > > ;-) > > > > Thnaks all, > > -- > > > > Julio Nobrega > > > > A hora está chegando: > > http://toca.sourceforge.net > > > > > >

« previous php.pear.general (#481) next »