Home arrow PHP arrow Previous or Next? Paginating Records with PHP, part 1

Previous or Next? Paginating Records with PHP, part 1

Putting all of your content for a particular file on one page can be very user unfriendly to website visitors. Nobody likes to be confronted by a tiny vertical scroll bar! In this article, the first in a series, you will learn a simple way to paginate records from a text file using PHP.

TABLE OF CONTENTS:
  1. Previous or Next? Paginating Records with PHP, part 1
  2. The first step: paginating records in a procedural way
  3. A deeper look at the "paginatetRecords()" function
  4. Putting the "paginateRecords()" function into action: procedural record paging
By: Alejandro Gervasio
Rating: starstarstarstarstar / 23
April 26, 2005

print this article
SEARCH DEV SHED

TOOLS YOU CAN USE

advertisement

Introduction

We see it every day, when surfing the Web looking for new content to expand our background as Web developers. More and more websites offer vast amounts of fresh information to satisfy users and keep them coming back for more. Most of the time, data is stored in databases and displayed according to user requests, in a fairly decent way, sticking more or less to the principles of readability. So, what's wrong about it?

If we take a look at some popular professional websites, we immediately notice that they offer some kind of paginating mechanism to display database records. From simple "previous" and "next" navigational links, to more complex numerated links, the range is quite wide. Let's take the case of Google, for showing an excellent example of a sophisticated and efficient paginating system. Fine, let's admit it. Here, we're talking about the big boys who most of the time (but certainly not always) do know what approach to take when dealing with record paging.

But, what about the others? Don't tell me that you never had to suffer that annoying experience of finding a website that happily loads its content, while you're watching with a feeling of growing panic as the vertical scroll bar control gets tinier and tinier! Oh, is that a severe punishment, or what?

But let's stop being ironic and face the problem that we have here. Showing elegant, paginated information gives our sites a very polished look, and certainly is a great way to enhance readability for visitors. Thus, the subject is relevant enough to be seriously considered. That's where this article comes in. We're going to present different approaches for implementing an efficient paginating mechanism using PHP, which hopefully will be useful to employ on any existing or future Web projects. So, let's jump to the next section to find out more.



 
 
>>> More PHP Articles          >>> More By Alejandro Gervasio
 

blog comments powered by Disqus
   

PHP ARTICLES

- PHP Closures as View Helpers: Lazy-Loading F...
- Using PHP Closures as View Helpers
- PHP File and Operating System Program Execut...
- PHP: Effects of Wrapping Code in Class Const...
- PHP: Building Concrete Validators
- Sanitizing Input with PHP
- Executing Shell Commands with PHP
- Handling File Data with PHP
- File Security and Resources with PHP
- ArrayObject PHP Class Examples
- ArrayObject PHP Class: An Introduction
- Getting File System Data with PHP
- PHP Tools for Working with the File and Oper...
- Working with the File and Operating System w...
- PHP Proxy Patterns: Completing a Blog


© 2003-2012 by Developer Shed. All rights reserved. DS Cluster 5 - Follow our Sitemap

Dev Shed Tutorial Topics: