Home Drupal Creating an Alpha Pager with Views 2 and Drupal 6
formats

Creating an Alpha Pager with Views 2 and Drupal 6

Published on July 22, 2010 by in Drupal, PHP

This is a reprint of an article I found here:

http://tedserbinski.com/tags/drupal/creating-alpha-pager-with-views-2-and-drupal-6

This is article that saved me tons of hours while I was chasing my tail trying to find an easy way to do this, reprinted so I can remember it later:

From reading all of the docs and quietly watching development commits, I knew Views 2 was going to eliminate a lot of the Views 1 helper modules and open up a whole new world of awesomeness. While I haven’t seen many blog posts detailing just which functionality/modules have been replaced with Views 2, I wanted to kickstart things with my own discovery as I played around with Views 2 quite thoroughly this afternoon.

With Views 1, to build an alpha pager you would use the views alpha pager module in conjunction with your view. But what about Views 2?

Well it’s not so straightforward. I read somewhere about some sort of “glossary” view, but how could that be used to create an alpha pager? Well turns out, quite easy. Here’s how:

  1. First, create a new page view and set your path to “directory”
  2. Assuming you want your pager to be based on the nodes title, add in an argument: “Node: Title”
  3. Set title equal to: “Directory: %1”
  4. Action to take if argument is not present: “Display all values”
  5. Check “Glossary Mode”
  6. Set character limit to “1”
  7. Case: “upper case”
  8. Case in path: “lower case”
  9. Save and update
  10. Add in a header under basic settings
  11. Set up your alpha pager:
<div> class="alpha-pager">

<a href="/directory/a">A</a>
<a href="/directory/b">B</a>
........
</div>

 
 Share on Facebook Share on Twitter Share on Reddit Share on LinkedIn
No Comments  comments 
© Brainstorms of a Webdev
credit