Do you have a favorite quote? (how I pieced together my Random quote widget).

May 27, 2007  |  Life  | 

I’ve been working on a widget that displays a random quote in the sidebar (or wherever you put it). It’s been a fun little project and I’ve really enjoyed working on it. I used the Executable PHP script from Otto and a bit of code I found laying around on the internet one day. I wish I had the link for that. But it’s simple enough.

Just drop in your widget from above and edit it.

Here’s the code you need to make it happen.

<?php

$quotes[] = “<i>You can insert your quote here.</i><br><b>~Author’s name</b>”;
*/for each new quote just copy and paste the above modifying the quote and author’s name.

srand ((double) microtime() * 1000000);
$randomquote = rand(0,count($quotes)-1);

echo “<p>” . $quotes[$randomquote] . “</p>”;

?>

———————

 

I am also looking for a few new great quotes to add. So if you find a good that you like, let me know in the comments here and I’ll add it to my collection.

 

subscribe

1 Comment


  1. Nevermind… this used to work prior to updating wordpress. Not anymore.

Leave a Reply

Recent Posts

Did you send this email?

I received an email today from someone with the following info: William,Hey I was wondering what are the costs, and all that is involved in setting up a website. I'm looking for a site that we can post pics, newsletters, and videos. I

Spiritual Warfare?

My wife and I have started working through reading the Bible together in a year.  It comes down to four chapters each night (we each read two) right now.  I am not sure if it doubles up chapters later or

The State of Change

Change is hard.  We all know it.  We get tied into a persona, a name, an idea and we one day find that it's not us anymore.  A friend of mine is contemplating changing his domain name.  His old domain

Mr. Deity and the Baptist

I can't resist sharing this.  I've been watching this show for awhile now.  If you have never heard of it, enjoy (and now you have).