Book Image

Learning Joomla! 1.5 Extension Development

Book Image

Learning Joomla! 1.5 Extension Development

Overview of this book

Table of Contents (17 chapters)
Learning Joomla! 1.5 Extension Development
Credits
About the Author
About the Reviewer
Preface

Using pagination to break up long lists


As the restaurant critics add more reviews to the system, the all view will become very long and readers will have to do a lot of scrolling. To make this screen more manageable, we will paginate the list of results so that only a certain number of reviews appear on the screen at a time; this is similar to the way search engines display several pages of results.

Note

Before writing more code, make sure there are at least six reviews in the database; adding reviews with titles, addresses, and quicktakes such as 'Test1' will be fine. This will ensure that there are enough reviews to paginate.

At the moment, the all view is being fed with database results from the model in the /administrator/components/models/all.php file. This model will need to be modified to handle pagination. The getData() function will now have to return only the rows to be displayed on the current page. A function for generating the pagination will also be needed. Finally, the pagination...