ShearerSite

How to Use

How To Use

Templates and includes are regular HTML files stored in a top-level _templates folder inside your web root. When applied, templates enclose the content of a document (they effectively include one or more content areas of the document within themselves). Documents (as well as templates, since they can be treated as documents) can contain includes, to embed repeating site elements. They are updated each time the template system is run over the document, so server-side includes aren't necessary. The template system takes special care to preserve embedded HTML scripting languages, such as ASP, PHP, and JSP, and has rules for merging together tags in the <head> elements of template and document. All files involved (documents, templates, and includes) are well-formed HTML files, not fragments, so they can all be opened by graphical HTML editors.

Specifying a Template

The Web administration interface allows you to select a default template for each folder, as well as a default template for subfolders. Having the capability to specify a different template for subfolders is often useful, and avoids having to go into each subfolder and set the template there. Internally, this information is stored in a _private/properties.ini file in a simple format that you can edit with a text editor if desired.

A template name of "none" tells the template system not to modify the page at all, no matter what its current state.

The default template can be overridden on a per-file basis with a META tag. For example:

<meta name="template" content="theTemplateNameGoesHere">

...between the <head> and </head> tags. The system would use theTemplateNameGoesHere.html in the _templates folder of the Web root.

Content Areas

The template system finds "content areas" in the source document, and substitutes them into the template. The content areas are kept marked in such a way that the template system can find them again on a subsequent run. So, reapplying the same template to a document leaves it unchanged.

There's one "main" content area. For simple HTML documents, it's everything between the <body> and </body> tags. For more complex documents, including those with templates previously applied, it's between <div id="template_content"> and </div>. (<span>, <td>, or any other element tags can be substituted for <div> if necessary; the id is what's important.) There can be any number of additional named content areas outside the main area, with the name appended to the ID, e.g. <div id="template_content_authorname">. All these content areas will be saved and matched up with areas in the template.

The template encloses the content of the document. But if, inside the content itself, you want to include a common element (say, a search box that is repeated in different places throughout your site) you would use:

<div id="template_include_searchbox"> ... anything placed here will be replaced with a search box </div>

and the content of searchbox.html in the _templates folder would be placed between the <div> tags.

Hierarchical Templates

Templates can be based on other templates, so that they form a hierarchy. Just follow the rules for regular documents, and run the template system over the _templates folder.

For instance, a company header & footer template, used sitewide, could be the parent of category-specific templates, which added headings or navigation controls.

Content-include areas in a parent template can be overridden at any level, by either a child template or a document.

For instance, a copyright notice in a top-level sitewide company template could be enclosed in a content-include. <span id="template_contentinclude_copyright">Copyright etc...</span>. In specific documents not created by the company, the content-include would be overridden to be empty (or, the document would use a template that did the same). <span id="template_content_copyright"></span>

Navigation

Two special includes display the FrontPage navigation hierarchy around the current page.

+++ Documentation to come.

Note: All URLs in templates and include files should be absolute (http://...) or site-relative (beginning with a slash), since the template system does not adjust them before inclusion in the final document (as FrontPage tries to).