A section of my site is a blog where I allow comments. Each comment has a thumbnail associated with it. If the commenter is a user, then their profile photo is used. If they are anonymous I have a pre-determined photo in place. I want to be able to randomly generate a thumbnail for these anonymous users, but also have no duplicates.
I asked this question here and now have a random thumbnail being generated, but the problem is that there are still duplicates. And it looks like because the comment.tpl.php file is being read on each comment that the random numbers are not being remembered.
How can Drupal remember the number so that it doesn't use it again?
$numbers = range(0, 19); shuffle($numbers); print "<div id='commenter-picture'>"; print "<img src='member_default_" . array_pop($numbers) . ".png' />"; print "</div>";