This is the ShearerSite template system tutorial.
Note: this tutorial is written to be used with the desktop web server that comes with the program,
so with this Internet version you won't be able to try out the directions. With that
in mind, keep reading.
Naturally this page has a template applied to it, and you can have hours (or minutes,
at least) of fun changing its look by applying different templates. We'll cover
how to do that in the next section. First, here's a quick decription of how it works.
When you apply a template to a page,
the unique page content is kept, but everything
from the old template (if any) is completely replaced. The text you're reading
is what's called the template_content region. Everything outside of it is
determined by the template itself. (That is, with the exception of some items
that should vary from page to page but belong up in the
<head> element: embedded scripts and styles, the page title,
and keywords, to name a few. The system also works hard to preserve ASP and other
server-side code that must be kept at the beginning or end of the file.)
Since the header and footer of this page come from the template, you can try messing them
up in an HTML editor. (Just keep the HTML code legal.) Reapplying templates will restore them.
This also demonstrates that it's important not to "paint outside the lines" while writing
content.
In the HTML source of the page, you can find the template_content region because
it's contained in an HTML element (div, span, td, or body) with
an id of "template_content", like this:
<div id="template_content">This is my content.</div>
(But what if the template you later apply is a table-based layout that puts
its content in a table cell--a <td> element
instead of a <div>? It doesn't matter. The content is what's between the tags.
The enclosing tags come from the template. So the <div> tags are replaced by
the template's <td> tags, and all is well. Using HTML elements as markers this way
promotes well-formed
HTML files, since balanced template and source files will produce a balanced
output file, and major errors in balancing the tag you have chosen will
be detected during template application.)
Even though this page already has a marked template_content region, most
of the web pages in the world don't. So for these pages (called "simple pages",
with no disrespect intended) the whole body of the page is assumed to be the template_content
region. If these pages belong to you and you're applying templates for the first time, you'll
probably need to remove whatever headers and footers are
already there to avoid duplication, unless they are of a type that
the template system knows how to remove on its own, such as FrontPage
borders.
After you have applied templates, the page always ends up with a template_content
block, so the system knows which part is important to keep next time.