Welcome to Geeklog, Anonymous Saturday, December 21 2024 @ 08:23 pm EST

Geeklog Forums

Random Quote


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;
}
 Quote

Status: offline

Dirk

Site Admin
Admin
Registered: 01/12/02
Posts: 13073
Location:Stuttgart, Germany
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 Wink

bye, Dirk
 Quote

All times are EST. The time is now 08:23 pm.

  • Normal Topic
  • Sticky Topic
  • Locked Topic
  • New Post
  • Sticky Topic W/ New Post
  • Locked Topic W/ New Post
  •  View Anonymous Posts
  •  Able to post
  •  Filtered HTML Allowed
  •  Censored Content