Status: offline

Peter_Apockotos

Forum User
Junior
Registered: 03/18/04
Posts: 29
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;
}

Status: offline

Dirk

Site Admin
Admin
Registered: 01/12/02
Posts: 13073
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