Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

PHPBuilder.com:
Using the PEAR Pager Package to Paginate MySQL Results
Apr 13, 2011 @ 15:35:40

On PHPBuilder.com today there's a new tutorial about using the PEAR Pager package to paginate through results from a MySQL query. The package makes it easy to pass in a data set and handle the pagination requests and interface.

Fortunately a great solution [for paginating data] is at your disposal which has been created expressly for this purchase. The PEAR Pager package will not only handle all of the gory tracking details for you, but it can also create a linked navigation list which you can embed into the page as a navigational aide for the user. In this article I'll show you how to use Pager to easily paginate your database results in a structured and coherent way.

He walks you through installing the packaged (thankfully easy with the PEAR installer) and how to use it on a simple array dataset of college names. From there he moves into the database realm, creating a simple table that stores the same information and pulling the results out and into the Pager functionality.

tagged: mysql paginate pear pager package tutorial

Link:

Sameer's Blog:
Simple Pagination in PHP tutorial
Oct 30, 2008 @ 15:29:02

Sameer has posted a new tutorial to his blog recently, a look at a drop-in solution for pagination in your application - the PEAR Pager package.

Pagination is a frequent requirement in web development projects. Most PHP developers must have already implemented paging in one form or other in their projects. In this post we will see how to add pagination the easy way using PEAR's Pager class. Note that in all the posts I use PHP 5.x.x, so if you are still stuck at version 4.x.x, its already time to upgrade.

He includes a simple example (just the page links), how to install the Pager package and a larger example where the results are pulled from a database table and paginated correctly based on an offset ID. There's even some CSS thrown in to make it a bit more pleasing to the eye.

tagged: pagination pear package pager install tutorial css

Link:

Zend Developer Zone:
Paging Data Sets With PEAR Pager
Aug 06, 2007 @ 20:15:40

On the Zend Developer Zone today, there's a new tutorial covering the use of the PEAR Pager class to break sets into smaller sets for all sorts of data sets (not just database results).

PEAR's Pager class, [which] offers developers a framework for breaking large data sets into smaller chunks, or pages, for greater readability or easier navigation. Pagination is important, particularly when dealing with result sets containing hundreds or thousands of items, because it allows the user to exert some degree of control over which segment of the data set is visible at any given point, and thus avoid drowning in a never-ending sea of data.

Cal explores the functionality this powerful little class has under the hood including working with pagination of normal arrays, database results and XML information. Of course, code is provided through out and screenshots are posted where needed to show what the output should look like.

tagged: pear pagination pager class tutorial array xml database pear pagination pager class tutorial array xml database

Link:

Zend Developer Zone:
Paging Data Sets With PEAR Pager
Aug 06, 2007 @ 20:15:40

On the Zend Developer Zone today, there's a new tutorial covering the use of the PEAR Pager class to break sets into smaller sets for all sorts of data sets (not just database results).

PEAR's Pager class, [which] offers developers a framework for breaking large data sets into smaller chunks, or pages, for greater readability or easier navigation. Pagination is important, particularly when dealing with result sets containing hundreds or thousands of items, because it allows the user to exert some degree of control over which segment of the data set is visible at any given point, and thus avoid drowning in a never-ending sea of data.

Cal explores the functionality this powerful little class has under the hood including working with pagination of normal arrays, database results and XML information. Of course, code is provided through out and screenshots are posted where needed to show what the output should look like.

tagged: pear pagination pager class tutorial array xml database pear pagination pager class tutorial array xml database

Link:

Lorenzo Alberton's Blog:
Navigation Through Paragraphs in an Article
Oct 16, 2006 @ 13:53:00

Following the PEAR::Pager class theme, Lorenzo Alberton has posted another pagination tutorial today with a look at using the package to "paginate" through the paragraphs of an article quickly and easily.

Users often prefer reading short chunks of text instead of scrolling a very long page (unless they want to print the page, then the opposite applies). In this tutorial, we're going to see how we can build an article pagination system, with a little help from PEAR::Pager.

Lorenzo provides both the database structure and sample data to work off of as well as (obviously) the code to make it all happen. The script is pretty straight-forward, especially if you've looked through his previous tutorial using the same class. Since the paragraphs are broken up into different rows in the database, it makes it simple to pull them out just like the pages of the articles before.

He also includes some alternative navigation styles to help make things look a bit different - a drop-down, an article summary (of the sections), and a printer-friendly version.

tagged: pagination pear pager package tutorial paragraphs pagination pear pager package tutorial paragraphs

Link:

Lorenzo Alberton's Blog:
Navigation Through Paragraphs in an Article
Oct 16, 2006 @ 13:53:00

Following the PEAR::Pager class theme, Lorenzo Alberton has posted another pagination tutorial today with a look at using the package to "paginate" through the paragraphs of an article quickly and easily.

Users often prefer reading short chunks of text instead of scrolling a very long page (unless they want to print the page, then the opposite applies). In this tutorial, we're going to see how we can build an article pagination system, with a little help from PEAR::Pager.

Lorenzo provides both the database structure and sample data to work off of as well as (obviously) the code to make it all happen. The script is pretty straight-forward, especially if you've looked through his previous tutorial using the same class. Since the paragraphs are broken up into different rows in the database, it makes it simple to pull them out just like the pages of the articles before.

He also includes some alternative navigation styles to help make things look a bit different - a drop-down, an article summary (of the sections), and a printer-friendly version.

tagged: pagination pear pager package tutorial paragraphs pagination pear pager package tutorial paragraphs

Link:

Lorenzo Alberton's Blog:
PEAR::Pager - Navigation with Pager and AJAX (or simple Javascript)
Oct 03, 2006 @ 18:15:43

Lorenzo Alberton is back today with another tutorial dealing with the PEAR::Pager class. This time, he focuses on using it with some simple Javascript and Ajax.

Not everyone has jumped on the (Ajax) bandwagon, though, and many libraries still exist without implementing this feature, so you're faced with the dilemma: should I keep using that old library and give up my cool AJAX ideas, or should I implement my own version?

If you're looking for a pager class with these requisites, I'm happy to reassure you about PEAR::Pager: it is AJAX-ready, and has been since a long time ago. 100% buzzword-compliance guaranteed!

He gives two examples of what he means - one just using the Pager package to create Javascript lists and divide them into paginated chunks and the other to work with an Ajax connection (via PEAR::HTML_AJAX) to grab the data and push it into a container DIV on the page.

tagged: pear pager package javascript ajax list pear pager package javascript ajax list

Link:

Lorenzo Alberton's Blog:
PEAR::Pager - Navigation with Pager and AJAX (or simple Javascript)
Oct 03, 2006 @ 18:15:43

Lorenzo Alberton is back today with another tutorial dealing with the PEAR::Pager class. This time, he focuses on using it with some simple Javascript and Ajax.

Not everyone has jumped on the (Ajax) bandwagon, though, and many libraries still exist without implementing this feature, so you're faced with the dilemma: should I keep using that old library and give up my cool AJAX ideas, or should I implement my own version?

If you're looking for a pager class with these requisites, I'm happy to reassure you about PEAR::Pager: it is AJAX-ready, and has been since a long time ago. 100% buzzword-compliance guaranteed!

He gives two examples of what he means - one just using the Pager package to create Javascript lists and divide them into paginated chunks and the other to work with an Ajax connection (via PEAR::HTML_AJAX) to grab the data and push it into a container DIV on the page.

tagged: pear pager package javascript ajax list pear pager package javascript ajax list

Link:

Lorenzo Alberton's Blog:
PEAR::Pager Tutorials
Sep 19, 2006 @ 12:31:52

Lorenzo Alberton has posted a tutorial today about using teh PEAR::Pager package to create "pretty links" with a little help from mod_rewrite.

Most PHP pager classes can work just fine with GET parameters, correctly forwarding them through the pages. Few of them let you control the navigation links they create, though. This can be particularly annoying when you have some nice urls (thanks to some mod_rewrite rules o to your hand-crafted front controller) and the pager class can't respect them, showing the real, ugly links to the world.

If the above scenario is not new to you, then you should probably have a look at PEAR::Pager. It's a fully customizable package that should satisfy all your needs, including your preferred link format.

In his examples, he provides the mod_rewrite rules to use, a sample PHP script that would normally use the $_GET values (in an ugly URL) to paginate the results. He also compensates for if the page number is actually a part of the path and not just at the end of the file name.

tagged: pear package pager tutorial mod_rewrite rules get page number pear package pager tutorial mod_rewrite rules get page number

Link:

Lorenzo Alberton's Blog:
PEAR::Pager Tutorials
Sep 19, 2006 @ 12:31:52

Lorenzo Alberton has posted a tutorial today about using teh PEAR::Pager package to create "pretty links" with a little help from mod_rewrite.

Most PHP pager classes can work just fine with GET parameters, correctly forwarding them through the pages. Few of them let you control the navigation links they create, though. This can be particularly annoying when you have some nice urls (thanks to some mod_rewrite rules o to your hand-crafted front controller) and the pager class can't respect them, showing the real, ugly links to the world.

If the above scenario is not new to you, then you should probably have a look at PEAR::Pager. It's a fully customizable package that should satisfy all your needs, including your preferred link format.

In his examples, he provides the mod_rewrite rules to use, a sample PHP script that would normally use the $_GET values (in an ugly URL) to paginate the results. He also compensates for if the page number is actually a part of the path and not just at the end of the file name.

tagged: pear package pager tutorial mod_rewrite rules get page number pear package pager tutorial mod_rewrite rules get page number

Link:


Trending Topics: