Building a Page Controller with the jQuery Quick Pagination Plug-in
Welcome to the final installment of the series that introduces you to the jQuery Quick Pagination plug-in. Comprised of five parts, this series takes an in-depth look at the most useful features provided by this jQuery add-on and shows you how to use it either for splitting up hard-coded HTML elements, such as paragraphs and images in chunks of readable data, or for paginating sets of database records.
Building a Page Controller with the jQuery Quick Pagination Plug-in - Building a simple page controller in PHP (Page 3 of 4 )
While its name may sound somewhat intimidating, a PHP page controller is nothing but a simple script that separates the server-side processing part from the output that it produces. In this particular case, I'm going to use a controller like this first for fetching the set of users-related rows stored on the associated MySQL, and then for displaying the data on the browser.
The page controller will be implemented within a file called "content.php," and will look like this:
There you have it. As you can see above, first the page controller uses an instance of the previous MySQL abstraction class to fetch all of the users existing in the database, and then displays this data formatted as HTML divs. While it's fair to stress that in this case both application logic and visual presentation rest in the same file, a page controller handles both layers separately, which is much cleaner than using a quick and dirty transcription script.
So far, so good. At this stage, the "content.php" file shows all of the records contained in the pertinent "users" MySQL table. So, what's the next step? Well, it's necessary to use the Quick Pagination plug-in to paginate those records and assemble the previous header, content and footer sections into a single web page.
All of these tasks will be accomplished in the next section. So click on the link below and read the next few lines.