A friend of D. Keith Robinson made up a MadLib for Keith’s birthday the other day and asked him to post it on his website and start a “meme.” It looked fun to me, but all of the fill-in-the-blanks were embedded right in the story, so it was missing that element of goofy surprise that I remember about the MadLibs I did as a kid.
As it turns out, this MadLib presented just the opportunity I needed to try to write my first PHP script. Even though I had bought PHP for the World Wide Web: Visual Quickstart Guide months ago to learn how to do some rudimentary programming, I never got around to actually using it—probably because I didn’t have a compelling reason to do so. It’s usually a lot easier to learn things when the lessons can be applied immediately—especially when it comes to languages, whether they be human or computer.
Anyway, the script is really simple, but I suppose I need to start somewhere. It pulls values that have been entered into a form and inserts them into a story. When fields are left blank, it inserts default values. With the help of a friend, I also managed to get it to properly use “a” or “an” in most cases, except when the following word begins with some consonant-sounding vowel, such as “eulogy” or “urinal.”
So, check out the Typical Day MadLib Generator and play around with it a bit and let me know what you think.