0

I have an archive Views page in Drupal 7 that is paginated after 10 items, themselves grouped and sorted by a taxonomy term ("issue date").

I've been asked whether it's at all possible to make the pager more descriptive based on the taxonomy vocab — i.e., instead of it just being "Go to Page 2", it's "Go to issues 2012-07-06 to 2012-06-29".

Any idea how I'd do that? Thanks!

1

I can't really understand why dates are stored as taxonomy terms, but yes, you can solve your task with powerful plugin system of Views. You should create custom views pager, which adds specific conditions to Views query.
The best example is an article by Views author Earl Miles: Creating a Date Pager Plugin for node "created" field (wow! dates, too).

As an example, we’re going to create a pager plugin that is somewhat useful, and completely non-traditional for Drupal. You have, however, very likely interacted with a pager of this nature before. Instead of relying on the number of results, we’re going to rely on the post date of the content...

The code is avalible in Views plugin examples module.
Your task is more complex and, of course, requires professional skills.

1
  • 1
    It's because the dates are related to a specific issue, which will have more data attached to it than just a timestamp - e.g., a cover and a PDF. You could also think of it in terms of "Vol. 1, Iss. 1, Vol. 2, Iss. 2..." etc. Also, that link is great, will accept this as my answer if nobody responds with something more straightforward in the next 24h.
    – aendra
    Jul 6 '12 at 12:16
0

If you specify the issue by using a Date field instead of a taxonomy term, you could use a date based pager. (It might also work with a taxonomy term if you do some handling to convert it to a timestamp in the argument handling code.)

Download the Date module at and be sure to active its Date Views submodule. That will add a Page by date option to the pagers listed in your Views config page. Here is a nice writeup by Richard Schulte on how to configure the date pager.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.