Introduction to templates

Introduction to templates

Template files are the building blocks of your vldPersonals site. They fit together like puzzle pieces to generate any web page on your site. Some are used repeatedly for every web page, like the header and footer template files, while others are used only under specific conditions.

vldPersonals is built from quite a few templates files. (.tpl) Template files are the instructions that tell the program, server and browser how to display various content information.

A traditional web page consists of two files types: the HTML page to hold the structure of the page and the style sheet which holds the presentation styles of the page. In vldPersonals, the style sheet is still present, but the HTML structure is divided into various parts and pieces. Blocks if you will, that can be put together in many different ways to generate a single web page. These blocks are known as template files. Each vldPersonals template is made up of a style sheet and the building blocks or template files to generate the different page views found on a vldPersonals site.

Think of it as kind-of a mail merge document. You want to send a form letter to 50 different people at 50 different addresses with different information in each letter. The addresses and information are stored in a database file. You write your letter then merge it with the address book. The mail merge places the addresses and names in the correct places…. well that's what a .tpl file does.

The .tpl files tell the program what to do with the data. .tpl files are almost in pure HTML however you'll notice some tags and comments throughout those files that are not standard HTML.

such as:

<!-- IF loggedin == "1" -->
<div class="block news">
{news:limit=5,cache_time=0}
</div>
<!-- ENDIF -->

The above example will only display news when the member is logged in.

These tags conditional IF statements and PHP calls are required in order to display dynamic content such as members, news, blogs, etc.

Before editing a template, make sure you know at least the the basics of HTML and CSS. Also make sure your site looks correct in Internet Explorer and FireFox.

One last thing, as a rule Always, always, always, make, save and keep a good working copy of your live site on your local drive. This way you always have a good working copy to revert to if something goes wrong with any mods and/ or changes you make