Drupal - Display Random Quotes

The following PHP snipet allows you to add a block to your Drupal site that will display a random quote from a list of user defined quotes.

Create a new block. Set the input format to PHP code. Then paste in the following (changing the quotes as desired, obviously):

<?php
$quotes[] = "Quote 1";
$quotes[] = "Quote 2";
$quotes[] = "Quote 3";
$quotes[] = "Quote 4";
srand ((double) microtime() * 1000000);
$randomquote = rand(0,count($quotes)-1);
echo "<div class=\"quote\"><p>\"";
echo $quotes[$randomquote];
echo "\"</p></div>";
?>

That's it. Now add the block to your site as normal.

The United States would only

The United States would only benefit from the reconnection with the Native Americans because there is far more to the world that could be better pass4sure 642-383 understood through their eyes rather than the shallow opinions of today's society. Native Americans have always been known to be earthy people who maintain a healthy relationship with the earth. If society would reconnect with the Indians it would help in better understanding the present because in order to understand the present fully one must know the past and understand it completely. The society of United States would greatly benefit from learning pass4sure 1Y0-A05 from the past mistakes done by either United States or Native Americans. Americans and Native Americans didn't get along very well in the past, but with a little more help and determination a bond may form through personal matters. Personal matters affect all people no matter what race they are. All humans are affected by their surroundings in some way and this is a way in which all humans relate. To reconnect with pass4sure 642-426 the Native Americans would mean that the United States would become closer to the environment and in a way more spiritual towards the world. Indians teaching Americans to be more spiritual isn't like a religious pass4sure HP0-Y23 spiritual; it is a strong relationship that is constantly growing.

Native Ame

Awesome

I'm not very well versed in PHP, but how often is this coded to switch to another random quote? How would I go about changing it to change to a different quote everytime the page is refreshed?

Belay my last...

haha I added the code into my page.tpl.php for the theme, so that it displays in the mission statement area of the theme. I was just refreshing the page at first. After posting my last comment, I went to work on something else with the site, and while navigating around the site, I saw that it changes when a different page is loaded.

Thanks for the great code! :-)

RE: Belay my last...

Glad it was useful. Why on earth were you working on a Drupal template at that hour on Christmas Eve though...KEEN!

Thanks

A really simple solution.