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

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.

If you liked this post, buy me a coffee -

If you liked this post, you might also like the following:

This entry was posted in Life and tagged . Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

One Comment

  1. William
    Posted May 29, 2007 at 2:10 am | Permalink

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

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*

Subscribe without commenting