News Feed
Sections




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

Lorenzo Alberton's Blog:
PEARPager Tutorials
September 19, 2006 @ 07: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.

0 comments voice your opinion now!
pear package pager tutorial mod_rewrite rules get page number pear package pager tutorial mod_rewrite rules get page number


blog comments powered by Disqus

Similar Posts

Community News: Latest PEAR Releases for 08.20.2007

Till Klampaeckel's Blog: Cooking PHPUnit (and a chef-solo example on top)

PHPBuilder.com: Create a PHP-based Twitter Client with the PEAR Services_Twitter Package

PHPMaster.com: Server-Side Device Detection with Browscap

DZone.com: Creating a virtual server with Vagrant: a practical walkthrough


Community Events

Don't see your event here?
Let us know!


release community symfony library unittest framework version laravel5 laravel interview series opinion api podcast introduction language extension voicesoftheelephpant security threedevsandamaybe

All content copyright, 2015 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework