Chapter 5 - Creating New TemplatesOK, unfortunately it is here that I likely will lose half of my reading audience. Stated another way, one of my readers is destined to leave now, never to return. And the reason is that in order to continue with this book, you must have at least a passing acquaintance with HTML and CSS. (A little programming knowledge wouldn't hurt either.) If you have neither, you're not quite out of luck but I hope you are satisfied with the default pages Thingamablog is generating right now. Cause you 'aint be going to doin' a whole lot o' customization if you know what I mean - nudge nudge wink wink.
For you left over, (stated another way, the other reader) here's a refresher...much like a Snickers bar goes from the store's shelf to your mouth, and through your digestive tract, and then back into nature from whence it came (There. I can die now. I finally used "whence" in a statement,) here's how various types of Thingamablog user's take an idea from their fertile and active imaginations, send it out through their fingers, through Thingamablog and then into Internet where nobody will ever see it no matter how much they prostitute themselves on Facebook to gain friends popularity for their web site...Note: this was just the author's experience. YMMV.
"The
train motif becomes evident in a minute..."Just for background, here's how the old-school hand-coder creates a web page:
1. He/she (OK, it's me - HE) has an idea for chicken-flavoured ice-cream.
2. He types into a text editor:
<html>
<head>
<title>Stephan Hoppe's Ideas</title>
<link rel="stylesheet" href="styles-site.css" type="text/css"
/>
</head>
<body>
<p>I have an idea for chicken-flavoured ice-cream (and though
already married, I wish to
pursue relationships with people with similar
ideals.)</p>
<p>Signed,<br />
Stephan Hoppe<br />
January 1, 2009
</p> <!-- every entry is "signed" by me and has my name
and the date -->
</body>
</html>
3. He saves his document as cfic.htm, and with that choice of file extension, identifies that document as a web page to any browser that may request it.
4. Using his FTP client, he sends his document (cfic.htm) up to his website, and then he publicizes the hell out of the page by placing pieces of paper under the windshield wipers of 25% of the cars at the mall stating: "Check out http://www.penspublishing.com/UT/cfic.htm !!!"
OK, Here's how the HTML novice using Thingamablog would create a web page:
1. He/she (me again) has an idea for chicken-flavoured ice-cream.
2. He types into the TAMB New Entry Editor:
I have an idea for chicken-flavoured ice-cream (and though already married...)
Signed,
Stephan Hoppe
January 1, 2009
3. He clicks TAMB's handy update and publish button.
4. With all of the time he saves on page creation, he is now able to place pieces of paper under the windshield wipers of 50% of the cars at the mall stating: "Check out http://www.penspublishing.com/UT/blog.html !!!"
And here's how the Thingamablog pro does it:
1. He wishes to make the world aware of a few minor errors that Stephen Hawking made in this month's issue of the American Society of Science and Technology newsletter.
2. He long ago coded his main.template to look like so:
<html>
<head>
<title><$BlogTitle$></title>
<link rel="stylesheet" href="styles-site.css" type="text/css"
/>
</head>
<body>
<BlogEntry>
<p><$BlogEntry$></p>
<p>Signed,<br />
<$EntryAuthor$><br />
<$EntryDate$> </p> <!-- every entry is
"signed" by me and has my name and the date -->
</BlogEntry>
</body>
</html>
2. Graceful as a gazelle mangling a simile, he types into the TAMB New Entry Editor:
I feel that Mr. Hawking recent propositions, though concise, were a little simplistic considering (...)
3. He clicks click TAMB's handy update and publish button.
At this point Thingamablog's steam-powered bellows immediately fill with air while its coal fired engines scream with the strain being put on them. Pappy shouts: "she's gonna blow fer shore this time - hee HEE!!!" At first laboriously, and then with increasing speed Thingamablog saves the entry to the Hypersonic (seriously) SQL thingamablog.db. Thingamablog then opens up the main.template and looks for global variables tags (like <$BlogTitle$>) and replaces those with information from the "Configure Weblog Settings" section of the blog (stored in the user.xml.)
Now with increasing speed, Thingamablog locates the maximum
number of entries allowed for the front page (Configure Weblog
Settings - Front Page tab - Limit Front Page Entries To:) and pulls
that number of entries from thingamablog.db. Then, it sticks each
entry in between the <BlogEntry></BlogEntry> tags,
replacing any entry specific variable tags (like
<$EntryAuthor$>) with stored information.
Moving like greased lightning now, Thingamablog uses its built in FTP client to send the file to the web server, where it floats down and gently comes to rest in the root web folder. Thingamablog then parses required entries out of the database into the remaining templates (like entry.template, archive.template etc.) and shoots those off to their repsective folders with blistering speed. Nothing will stop Thingamablog now! Except, er...when it's finished updating the web site. Yes, that will stop it. So then Thingamablog stops, always at the ready, watchful and waiting.
Does that sound like Greek to you? Then please see above.
4. He is now able to place pieces of paper under ALL of the windshield wipers at the mall, AND get home before Mom calls him in for dinner.
Remember:
main.template = front page
entry.template = entry pages
category.template = category pages (one page per category)
archive.template = archive pages (one page per user-defined archive period)
index.template = a page listing all of the archive and category page links
(We'll deal with the feed.template later.)