[paid] Random Quote Module

Nov 26, 2006 20:13

Someone in another community asked about a random quote generator for the Bloggish style. Again, I didn't write the code, merely pieced it together for the Bloggish style. Thanks (once again) to component_help.

Insert this code into a theme layer to have random quotes in a module. Change the red parts to suit your needs.


function print_module_customtext(string title, string text, string titlelink_url) {

$title = "Random Quotes";

var Page p = get_page();

open_module("customtext", $title, $titlelink_url);

var string[] quotes;

$quotes[0]="""Imagination is the one weapon in the war against reality.""";

$quotes[1]="""No man needs a vacation so much as the man who has just had one.""";

$quotes[2]="""Call no man foe, but never love a stranger.""";

$quotes[3]="""The secret to creativity is knowing how to hide your sources.""";

$quotes[4]="""My own business always bores me to death; I prefer other people's.""";

$quotes[5]="""All paid jobs absorb and degrade the mind.""";

$quotes[6]="""Education is a progressive discovery of our own ignorance.""";

var int randquote;

$randquote = rand(0, ((size $quotes) - 1));

"$quotes[$randquote]";

close_module();

}

modules:custom module, tutorial:random quotes, tutorial, tutorial:modules, modules

Previous post Next post
Up