| Author |
The saying that changes under the logo |
Propheis
Member
Posts: 4
Location:
Joined: 03.12.09 Rank: Newbie |
|
|
Hey, I'm designing a web page, and i was wondering how they got the saying under the logo to change every time you reload the page. I would like to have the same thing in my web page |
|
| Author |
RE: The saying that changes under the logo |
Compromise
Member
Posts: 224
Location:
Joined: 11.11.09 Rank: Moderate Warn Level: 30
|
|
random number generator + array full of sayings.
Fill the array with a textfile btw (like fortune).
CrazySpai |
|
| Author |
RE: The saying that changes under the logo |
define
Member
Posts: 201
Location:
Joined: 13.12.08 Rank: Moderate Warn Level: 1
|
|
... or, if you want to really make it interesting:
Get an array of subjects, array of verbs, and array of predicates, and use those to randomly generate "quotes". Then, use the names of famous politicians of the past to attribute the "quote" for bonus humor points.
If you need to contact me, send me a PM. I will read and/or respond in time. |
|
| Author |
RE: The saying that changes under the logo |
wolfmankurd
Member

Posts: 1519
Location: UK
Joined: 30.05.05 Rank: God |
|
|
define wrote:
... or, if you want to really make it interesting:
Get an array of subjects, array of verbs, and array of predicates, and use those to randomly generate "quotes". Then, use the names of famous politicians of the past to attribute the "quote" for bonus humor points.
To make it even better use a markov chain. Anyways, here's some code
<?PHP
$file = file_get_contents('file.txt');
$lines = explode("\n",$file);
echo $lines[mt_rand(0,count($lines)-1)]."\n";
?>
Will read lines from "file.txt" and print out a random line.
BY READING MY POST, YOU ACCEPT IT AS IS AND AGREE TO MY DISCLAIMER OF ALL WARRANTIES, EXPRESS OR IMPLIED, AS WELL AS DISCLAIMERS OF ALL LIABILITY, DIRECT, INDIRECT, CONSEQUENTIAL OR INCIDENTAL, THAT MAY ARISE FROM THE USE OF THIS (MIS)INFORMATION.

Edited by wolfmankurd on 28-12-09 18:20 |
|