|
Posted by Captain Paralytic on 09/19/06 13:56
Jeff Gardner wrote:
> Greetings:
>
> I've a script written for paging through a given recordset with page
> links, etc. I want to be able to limit the number of page numbers
> displayed as a large query may result in 100 or more pages and having
> 100 or more page links is ugly, to say the least. Below is the code
> that I am using for the paging. I'd like something like pages 1 - 5,
> click 5 or next, then pages 6-10 are displayed, etc. I am not sure where
> to start as far as limiting the number of pages displayed though and any
> advice is appreciated.
> <snip>
> $rsNav="";
> if($page > 1) {
> $rsNav .= "<A HREF=\"$_SESSION[PHP_SELF]?page=" . ($page-1) .
> "&SearchString=" .urlencode($SearchString) . "\"><< Prev</A> ";
> }
> for($i = 1 ; $i <= $NumberOfPages ; $i++) {
> if($i == $page) {
> $rsNav .= "<B>|$i|</B> ";
> }else{
> $rsNav .= "<A HREF=\"$_SESSION[PHP_SELF]?page=" . $i .
> "&SearchString=" .urlencode($SearchString) . "\">$i</A> ";
> }
> }
> if($page < $NumberOfPages) {
> $rsNav .= " <A HREF=\"$_SESSION[PHP_SELF]?page=" . ($page+1) .
> "&SearchString=" .urlencode($SearchString) . "\">Next >></A>";
> }
> echo "<BR>" . $rsNav;
> </snip>
> --
>
> Regards,
>
> Jeff Gardner
Take a look at http://phpclasses.fonant.com/browse/package/3076.html
[Back to original message]
|