I’ve converted my homepage to php. This has the benefit of maintaining standard HTML interaction, while allowing me to script certain things into my page. I wrote this because I hate java and java script with a passion. I blame it on my college’s use of blackboard. Its enough to make any one think twice.


For instance, if you will look at the bottom of my page, you will see a random quote appear. Here’s the code, which is really the whole reason for my making this post:

<?php
$quote_number = rand(0, 2);
$quotes = array( "A strange game. The only winning move is not to play. How about a nice game of chess?",
"We are the knights who say "Ni!" ",
"Umm, I'm a cucumber!" );
echo "{$quotes[$quote_number]}";
?>

Respectively, WarGames, Monty Python and the Holy Grail, and Larry the Cucumber

There’s not much to say about the code, I think it is fairly self explanatory.

The first line generates a random variable between 0 and 2. This is really quotes 1 -3. If you add more quotes, you need to add increase the number.

The second line is an array holding the quotes. The third line outputs the quote. Wrap it in <p> tags and you’re golden.

Next up is getting ahold of the latest twitter post I make and displaying it on my homepage . . . .