Came up with a fairly simple method to stick random quotes into Movable Type pages (requires PHP).
1) In the Templates section, create a new Index template called quotes.inc. In it, place one quote per line.
2) Put this code in your page template(s) where you wan the random quote to appear:
// Select a random quote from an array
// On the next line, enter the full path on your web server
// to the generated quotes file.
// No need for any other changes to this code block.
$quotes = file(‘/full/path/to/quotes.inc’);
// Seed the random number generator
$somerand = srand ((float) microtime() * 10000000);
// How many quotes do we have to work with?
$num_quotes = sizeof($quotes);
// Choose a random number between 0 and the number of quotes in the array
$this_quote = rand(0,$num_quotes – 1);
// Now we have a random number to select from the array index, grab it.
$thisquote = $quotes[$this_quote];
// Spit it back
Also referenced here.
4 Replies to “Random Quotes”
Works great! I’ve put it below my blogroll; thanks so much!