Next Generation Emulation banner

1 - 3 of 3 Posts

43 Posts
Discussion Starter · #1 ·
Yes, thats me...Im clueless... :hdbash: When it comes to coding that is... :)

Here is what I want to do... I know how this site has the little quotes displayed on the main page, and they change every time you refresh...

Well... I want to do something similar to my site, except I want the quotes to change daily, not every refresh...

I have no idea how I would go about doing this... So any help would be greatly appreciated... Thanks in advance.

1,577 Posts
It's simple really:

1. Browser requests page
2. Server runs piece of code
3. Code, among other things, selects a random quote
4. Server returns the output back to the visitor

This is a small example, written in Perl, which cycles through a list of quotes. Using a new one each day.

my @quotes = ("I love deadlines. I like the whooshing sound they make as they fly by. --Douglas Adams",
              "A lot of people mistake a short memory for a clear conscience. --Doug Larson",
              "Censorship, like charity, should begin at home; but, unlike charity, it should end there. --Clare Booth Luce",
              "Sanity is a madness put to good use. --George Santayana");

my @ltime = localtime(time);

print $quotes[$ltime[7] % @quotes] . "\n";
1 - 3 of 3 Posts