Simple Rotating Block Content
There are a number of solutions available for management of content display within a block, creating slideshows, tabs, etc. Sometimes a simple rotating message is needed, and can be accomplished with a few lines of code. This example has 4 quotes with css classes that can be further styled in the theme's css.
One of the pre-requisites for entering php code into blocks is enabling PHP filter in admin/build/modules and setting appropriate user permissions. Once in the block edit mode, be sure to choose PHP code as the Input Format.
<?php $quotes[] = "<div class=\"front-quote-text\">Text1.</div>"; $quotes[] = "<div class=\"front-quote-text\">Text2.</div>"; $quotes[] = "<div class=\"front-quote-text\">Text3.</div>"; $quotes[] = "<div class=\"front-quote-text\">Text4.</div>"; srand ((double) microtime() * 1000000); $randomquote = rand(0,count($quotes)-1); echo "<div id=\"front-quote\">"; echo $quotes[$randomquote]; echo "</div>"; ?>





Comments
more suitable: (code, pre tags not working?)
<?php
$quotes[] = "Text1.";
$quotes[] = "Text2.";
$quotes[] = "Text3.";
$quotes[] = "Text4.";
srand ((double) microtime() * 1000000);
$randomquote = rand(0,count($quotes)-1); ?>
<div id ="front-quote">
<div class ="front-quote-text">
<?php echo $quotes[ $randomquote ]; ?>
</div>
</div>
Yes, that unifies the <div class ="front-quote-text"></div>, leaving the $quotes[] with just the text. My original application required different formating for each quote. Of course, all of this could be done with views if a more robust solution is needed.