I have a vocabulary called "genres" which holds terms like Fiction, Non-Fiction, etc. for categorizing books. My Books content type has an image field that holds a book cover.

Now, when I'm on a taxonomy listing page like /taxonomy/term/14 I want to be able to pull 3 random book covers, from nodes that are _on that page_, into a block. So if I have 100 nodes with that term (10 per page) and I'm on page 3 of 10, I only want to pull 3 random covers from records 21-30.

There has to be an efficient way to do this since Drupal has already pulled the data to be displayed in the body of the page. I'm assuming it's an array of nodes. If I can get at the same data/array I can easily randomize the book covers from there. I was thinking of using a PHP snippet for the block.

Any ideas?

Thanks.

Comments

joecanti’s picture

The Views Module might be of use - you can certainly use it to create blocks with photos - and you can get it to pick from a random list - and id imagine you could limit it to a range say 21-30...but the last bit im not sure about.

Cheers, Joe