Styling the Drupal pager
When displaying a large number of items on a page, it is often required that we paginate the results in order to keep things quick and simple for the user as well as for easing the load on the server. Drupal provides a pager API which can be used to easily accomplish this. Users are able to navigate to different pages of the result set using a pager element which typically links to the next and previous pages, first and last pages, and even a range of individual pages of the set.
In this recipe, we will be looking to theme this pager element and rework it to display an abbreviated page tracker instead of listing individual pages by number.
Getting ready
We will be using the myzen theme created earlier in this book as the example theme in this recipe. The Theme developer module will be used to identify the theme function to override.
How to do it...
First up, we need to identify how Drupal is going about theming the pager list. The quickest way to do so is by using the...