Why I Did It: Working With Walnuts, Part 1
In this newest installment of my ongoing "Why I Did It" series, I'm going to redefine the acronym "WWW" from being short-hand for "World Wide Web" to "Working With Walnuts" ~ So what the heck am I talking about now? For some of you, it just might be the coolest thing you've read in a long time...
"The coolest thing you've read in a long time:" A bold statement indeed, and perhaps more appropriately it should be "the most helpful thing you've read in a long time:" for if you've never used them while building your sites before, I'm about to make your life a whole lot easier by exposing you to the wonderful world of HTML "includes."
As I typically do when delving into "technical" issues, I will toss this disclaimer out up-front: I am not a programmer, and often my approach is more akin to wielding a sledge-hammer than to the surgical coding precision of a "Root God" like my pal C-Dawg — and everything I discuss here should not be viewed as the "best" or most technically accurate information available. It is rather the proven techniques that I have used and developed through trial and error, cut n' paste, and several drunken rages over bits of code that have eluded me over the years. These things work on my virtually-hosted domains; use them at your own risk.
"Includes" for Fun and Profit
With that out of the way, let me enlighten those who are unfamiliar with them: "Includes" are just that; snippets of code that are "included" on (usually) multiple HTML pages for a wide variety of reasons and uses.
Why? Consider a site with *many* pages. Now say you want to update the credits and copyright info, or the navigation bar, or the background image and text colors. You could go and manually edit all of those pages, and perhaps need to do so all over again in the future. But wouldn't it be cool if you could assign the values in question to a simple text file, and then by editing that file, cause global changes to your site? Well, that's what includes can do for you!
MS FrontPage "Include Bot"
My first exposure to using includes came from Microsoft FrontPage; a ubiquitous but quite controversial tool that I've used since version one was issued on diskette back in '94 or so. For those who are laughing, prior to my discovery of this gem from Heaven, I was writing HTML using "DosEdit" — and so FrontPage was a MAJOR improvement for me.
Anyways, at the time I had built my first network of AVS sites and was incorporating them into the first evolution of PORNWORKS. With roughly 500 pages, updating this pig was a seriously mind-numbing chore. A chore made much simpler by the FrontPage Include Bot. For those who've never used FrontPage, part of its power stems from a set of tools known as FrontPage Server Extensions that your Web Host installs on your server. These tools (known as "bots") contained an "include" bot, the value of which was dramatically shown to me when a major sponsor who provided most of the free content I used on my sites decided to change their linking URL syntax. I breathed a big sigh of relief — and thanked God that I was blessed with such powerful tools:
!--WEBBOT bot="Include" u-include="../_private/footer.htm" tag="BODY" startspan--
Now, all that I had to do was edit my footer.htm file, and voila! All of the pages were instantly updated with the sponsor's new linking code! I breathed a big sigh of relief — and thanked God that I was blessed with such powerful tools:
But what about those who do not use FrontPage? How can they use includes to perform these maintenance tasks and so much more? While other options may be available, two that I have (and do) use are PHP and Server Side Includes (SSI), both of which I'll discuss next in Part 2 ~ along with the "Walnut" revelation. Stay tuned! ~ Stephen