Advanced pagination in php

Discussion in 'PHP' started by DanielHB, Aug 24, 2006.

  1. #1
    I've created a simple page which fetches results from a mysql database and displays them with pagination. Currently it doesn't limit the number of pages shown, so if there are 26 pages and page 14 was selected, it would look something like this:

    Prev 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 Next

    I think there are too far too many pages displayed I would rather display the links in a phpbb style, something like this:

    Prev 1 2 3 ... 12 13 14 15 16 ... 24 25 26 Next

    The number of pages is stored in $total_pages and the current page is $current_page

    Has anyone done this before? I've looked at phpbbs generate_pagination function but its pretty complicated

    Thanks
    Daniel
     

    Attached Files:

    DanielHB, Aug 24, 2006 IP
  2. gigapromoters

    gigapromoters Peon

    Messages:
    309
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Goto phpclasses.org, there are several classes to do this..
     
    gigapromoters, Aug 26, 2006 IP