Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 1 of 1

Thread: PHP Pagination

  1. #1
    Member
    Join Date
    Nov 2002
    Location
    Elmira, NY
    Posts
    41
    Member #
    261
    i started doing this this morning and have currently like 75 pages with another 4 that i have to add. so far i have 42 pages of it in a db. and i use the pagelinks. i wanna condense the number of links to maybe 10 with ... in between.

    like maybe Pages: 1 2 3 4 5 ... 38 39 40 41 42 or whatever corresponds to the last pages. i just dont want all 67+ pages showing just like the first 5 and last 5 with ... in between or something

    kinda like this

    http://neonsonline.com/pagelinks.jpg

    below is the actual page and the code i use

    http://www.neonsonline.com/gallery.php

    this is the code i use for the pagelinks

    PHP Code:

    echo "<center><table width=\"75%\" cellpadding=\"5\" cellspacing=\"0\" class=\"main\">
    <tr><td width=\"25%\" valign=\"top\">"
    ;
    if (
    $page != "1") {
    $prevpage $page 1;
    echo 
    "<a href=\"{$PHP_SELF}?page=$prevpage\">Prev. Page</a>";
    }
    echo 
    "</td><td width=\"50%\" valign=\"top\" align=\"center\">
    Pages:&nbsp;"
    ;
    $pagelink "1";
    do {
    if (
    $page == "$pagelink") {
    echo 
    "$pagelink&nbsp;";
    } else {
    echo 
    "<a href=\"{$PHP_SELF}?page=$pagelink\">$pagelink</a>&nbsp;";
    }
    $pagelink $pagelink 1;
    } while (
    $pagelink <= $num_pages);
    echo 
    "</td><td width=\"25%\" valign=\"top\" align=\"right\">";
    if (
    $page != "$num_pages") {
    $nextpage $page 1;
    echo 
    "<a href=\"{$PHP_SELF}?page=$nextpage\">Next Page</a>";
    }
    echo 
    "</td></tr></table></center>"

  2.  


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 01:19 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com