Pagination

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Sharif T. Karim

    Pagination

    Anyone know of a up-to-date tutorial for pagination where I can have it
    like:

    Prev 1 2 3 4 Next

    Thanks.
    --
    Sharif T. Karim
    ....you don't know wrath yet...


  • Michael Austin

    #2
    Re: Pagination

    Sharif T. Karim wrote:
    [color=blue]
    > Anyone know of a up-to-date tutorial for pagination where I can have it
    > like:
    >
    > Prev 1 2 3 4 Next
    >
    > Thanks.[/color]

    if you go to google, groups, comp.languages. php and search for
    pagination, there was a recent discussion on this topic...

    <<
    http://groups.google.com/groups?hl=e...hp&btnG=Search[color=blue][color=green]
    >>[/color][/color]

    Michael Austin.

    Comment

    • Tony Marston

      #3
      Re: Pagination

      Try this for size: http://www.tonymarston.co.uk/php-mysql/pagination.html

      --
      Tony Marston

      This is Tony Marston's web site, containing personal information plus pages devoted to the Uniface 4GL development language, XML and XSL, PHP and MySQL, and a bit of COBOL



      "Sharif T. Karim" <sharif@nyc.rr. com> wrote in message
      news:ScHGc.6084 5$a92.5783@twis ter.nyc.rr.com. ..[color=blue]
      > Anyone know of a up-to-date tutorial for pagination where I can have it
      > like:
      >
      > Prev 1 2 3 4 Next
      >
      > Thanks.
      > --
      > Sharif T. Karim
      > ...you don't know wrath yet...
      >
      >[/color]


      Comment

      • Phil Powell

        #4
        Re: Pagination

        "Sharif T. Karim" <sharif@nyc.rr. com> wrote in message news:<ScHGc.608 45$a92.5783@twi ster.nyc.rr.com >...[color=blue]
        > Anyone know of a up-to-date tutorial for pagination where I can have it
        > like:
        >
        > Prev 1 2 3 4 Next
        >
        > Thanks.[/color]

        My concept of pagination, if it helps, is to perform the following
        steps:

        1) One single DB call to grab everything at one time that you need to
        list
        2) Store entire contents of the resultset into a $_SESSION variable
        (serialized, of course)
        3) Establish a $prev and $next routine with integer values that limit
        the amount of display per page and calculate your $prev and $next
        4) Upon each click of your "Previous" and "Next" links you will pull
        not from the DB but from the serialized $_SESSION variable to ensure
        efficiency and data reusability
        5) Filter results by $prev and $next to only display the results you
        need per page
        6) Also allow for a "view all" link if the user wants to see
        everything at one time
        7) *Important* When you go to view another set of stuff, be sure to
        "flush" the cache by destroying the $_SESSION variable to ensure not
        having latent results floating around in your $_SESSION cache.

        My $0.02

        Phil

        Comment

        • Geoff Berrow

          #5
          Re: Pagination

          I noticed that Message-ID:
          <1cdca2a7.04070 70808.29cefb2c@ posting.google. com> from Phil Powell
          contained the following:
          [color=blue]
          >4) Upon each click of your "Previous" and "Next" links you will pull
          >not from the DB but from the serialized $_SESSION variable to ensure
          >efficiency and data reusability[/color]

          And /is/ that more efficient than separate DB queries?

          Curious to know.

          --
          Geoff Berrow (put thecat out to email)
          It's only Usenet, no one dies.
          My opinions, not the committee's, mine.
          Simple RFDs http://www.ckdog.co.uk/rfdmaker/

          Comment

          • Henk Verhoeven

            #6
            Re: Pagination

            Hi,

            You could take a look at:

            It produces a paged display of instances of a peanuts domain model class
            (peanuts) that are loaded from all records from a table.

            Building the list of paging buttons is done by a seperate component:


            The acual output of buttons is done by instances of PntButtonsPart and
            PntButtonsPanel and the html table by PntTablePart, for code see:


            For a subclass that does searching in the database see:

            It uses a specialized part for generating and processing the search form:


            Or you could simply download the framework and use it,
            example:



            Greetings,

            Henk Verhoeven,
            www.phpPeanuts.org.

            Sharif T. Karim wrote:[color=blue]
            > Anyone know of a up-to-date tutorial for pagination where I can have it
            > like:
            >
            > Prev 1 2 3 4 Next
            >
            > Thanks.[/color]

            Comment

            • Sharif T. Karim

              #7
              Re: Pagination

              Tony Marston, being the foo Tony Marston is, wrote:[color=blue]
              > Try this for size:
              > http://www.tonymarston.co.uk/php-mysql/pagination.html
              >[/color]

              Thanks a lot Tony.

              --
              Sharif T. Karim
              ....you don't know wrath yet...


              Comment

              • Herbie Cumberland

                #8
                Re: Pagination

                In message-id <pkboe05421c66m dtssrlv0r7caqum gn5ik@4ax.com>,
                Geoff Berrow wrote:
                [color=blue]
                >I noticed that Message-ID:
                ><1cdca2a7.0407 070808.29cefb2c @posting.google .com> from Phil Powell
                >contained the following:
                >[color=green]
                >>4) Upon each click of your "Previous" and "Next" links you will pull
                >>not from the DB but from the serialized $_SESSION variable to ensure
                >>efficiency and data reusability[/color]
                >
                >And /is/ that more efficient than separate DB queries?
                >
                >Curious to know.[/color]

                dunno about efficiency, but i can certainly see an advantage where the
                data being retrieved is constantly changing - above approach provides
                the user session with a 'snapshot' of the database a a specific moment
                in time.

                of course, with many users and large data sets this would become a
                major problem, because you'd be creating a new 'copy' of the data for
                every user session, which would need to be stored on disk.

                hc.

                Comment

                • Phil Powell

                  #9
                  Re: Pagination

                  Geoff Berrow <blthecat@ckdog .co.uk> wrote in message news:<pkboe0542 1c66mdtssrlv0r7 caqumgn5ik@4ax. com>...[color=blue]
                  > I noticed that Message-ID:
                  > <1cdca2a7.04070 70808.29cefb2c@ posting.google. com> from Phil Powell
                  > contained the following:
                  >[color=green]
                  > >4) Upon each click of your "Previous" and "Next" links you will pull
                  > >not from the DB but from the serialized $_SESSION variable to ensure
                  > >efficiency and data reusability[/color]
                  >
                  > And /is/ that more efficient than separate DB queries?
                  >
                  > Curious to know.[/color]

                  For what I wrote, very much so, yes! Using timing techniques on
                  pages, the initial run of a listing query took the page download time
                  to average 1.5 - 2.0 seconds. Upon clicking "Next" (and then
                  subsequently clicking "Prev" or whatever) each page download time
                  decreased significantly, going to 0.1 - 0.5 seconds per iteration,
                  since it was delivering from $_SESSION instead of db query.

                  Phil

                  Comment

                  • Phil Powell

                    #10
                    Re: Pagination

                    Herbie Cumberland <non-existant@non-existant.tld> wrote in message news:<42loe0t2v rtrtmnrplbfnvqh ets2nm9ghb@4ax. com>...[color=blue]
                    > In message-id <pkboe05421c66m dtssrlv0r7caqum gn5ik@4ax.com>,
                    > Geoff Berrow wrote:
                    >[color=green]
                    > >I noticed that Message-ID:
                    > ><1cdca2a7.0407 070808.29cefb2c @posting.google .com> from Phil Powell
                    > >contained the following:
                    > >[color=darkred]
                    > >>4) Upon each click of your "Previous" and "Next" links you will pull
                    > >>not from the DB but from the serialized $_SESSION variable to ensure
                    > >>efficiency and data reusability[/color]
                    > >
                    > >And /is/ that more efficient than separate DB queries?
                    > >
                    > >Curious to know.[/color]
                    >
                    > dunno about efficiency, but i can certainly see an advantage where the
                    > data being retrieved is constantly changing - above approach provides
                    > the user session with a 'snapshot' of the database a a specific moment
                    > in time.
                    >
                    > of course, with many users and large data sets this would become a
                    > major problem, because you'd be creating a new 'copy' of the data for
                    > every user session, which would need to be stored on disk.[/color]

                    Ay and there's the advantage of what I built being that it's a
                    single-user internal application, that would mean only one 'copy'
                    would exist since there would be only one user session stored on disk.

                    Phil

                    [color=blue]
                    >
                    > hc.[/color]

                    Comment

                    Working...