I have installed the Random Quote block and was wondering what could be changed in order for a different quote to be shown once a day and not on every page load?
function phpblock_randomQuote()
{
global $_CONF;
$result = DB_query("
SELECT * FROM quote
ORDER BY RAND()
LIMIT 1
");
$res = DB_fetchArray($result);
$author = ($res['author']) ? $res['author'] : 'anonymous';
$source = ($res['source']) ? $res['source'] : '';
if ($source != '' && $res['year'] != '') {
$year = ", {$res['year']}";
} else {
$year = '';
}
$link = "
. $author . "'>" . $author . "";
$authorLink = ($author != 'anonymous') ? $link : 'anonymous';
$retval =
"{$res['quote']}"
--
$authorLink
EOF;
return $retval;
}
You would have to store the last quote (or its index) and the time when it was last selected somewhere, e.g. in Geeklog's gl_vars table.
Sounds like a good opportunity to start learning some PHP
bye, Dirk