Ah, the randomizer plugin… Try this in your template:
<?php srand((double)microtime()*1000000);
$quote_txt = preg_split("/--NEXT--/", join('', file("path/to/quotes.txt")));
echo $quote_txt[rand(0, sizeof($quote_txt) -1)]; ?>
Now you only need a quotes.txt file where you separate your entries with <newline> –NEXT– <newline>. You can even use some XHTML markup in there. Makes sense? Working perfectly for me.
I suppose you could turn that into a plugin, but I never bothered.
As a note, you could also set up all your random items in a weblog with each one as an entry, and use orderby=”random”. Essentially, though, plugins are an “all in one” kind of deal - you’d want something in the database to separate it out and store the quotes randomly, so a randomizer “module” - which is essentially what the weblog method is. =)
Yes, my method is decidely low tech. I forgot one thing, actually: I have my quote.txt file setup as a template, and saved as a file, so for once this going the other way: I am not editing en external file to update a template, I am editing a template to update my external file. (I actually have this working on config.php as well on one of my sites, although that took a symbolic link. It’s very cool to use EE to edit your .htaccess or config.php files.)
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.