Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Random Quotes

edited December 2006 in Vanilla 1.0 Help
Random Quotes


  • Options
    Thanks for this extension! Love it. One question, though. Can I make it change quotes daily instead of randomly? What would I need to alter in the code?

    The code is well documented, here's the critical bit:

    // Here we split it into lines
    $quotes = explode( $lineSeparator, $quotesString);
    // And then randomly choose a line
    $chosen = $quotes[ mt_rand(0, $i - 1 ) ];
  • Options
    I built a WP quotes plugin and one of the functions was a daily quote. I used the day of the year to find that one on my quotes file, assuming I had at least 365 quotes. You could loop through the quotes file:
    foreach ($result as $row) { $remainder = $counter % $dayofyear; if ($remainder == 0) { output the $row; break; } }
  • Options
    This is cool.. Gonna hack it up I think to randomly grab quotes from the forums though, as opposed to from a text file :)
This discussion has been closed.