Template It

Using Template It is pretty simple, once you know how and you have a good template to wrap your content into. I have provided a sample template in the separate download at www.lfi.net, containing sample templates I (or others, with luck) have made. At the time of the writing of this, there was only 'Basic', which looks moderately like this page. You can use the most complex template in the world in conjunction with Template It, it doesn't matter. First thing first: setting up Template It.

Once you have download the latest ZIP, extract it and if you want, make a shortcut to the EXE on the desktop or wherever else, depending on the amount you plan to use it. When Template It first starts, it will look like this (except, colourful):

The first thing to remember is, no matter HOW well you know the way to a path, you should browse...Or be 100% certain you end the path with the appropriate slash. Otherwise Template It will not only fail, but it will crash and show an error containing little to no lead to the cause.

ALL SETTINGS you change on this page are saved to an INI file in the same directory as the executable, except for the Debug checkbox. The settings you see are the defaults. In most cases, these are the best. However, I recommend you un-tick the 'Save space - remove vbCrLfs'. This setting doesn't save much space at all - it was originally going to work different, but was never needed so the initial code was not changed. Removing vbCrLfs (new lines) makes the end-user's HTML VERY messy, which might, or might not mean, that actual browsers have to work harder to interpret the code. Probably not, but if you are tracking down errors this will be a hassle.

The VbCrLf to <br> conversion is strongly recommended. When you use text files for dynamic variables, each new line in the text file gets changed to the recognized new line equalivelent for HTML - <br>.

Before I go any further, let me go into what each path is. Templates path is the path for the templates. Most of the templates you make will be 'standardized', so any of your sites can use common tags to work with them. The Info Path (with INI) contains the text files with the content in them. The INI file mentioned is Statics.ini, which I named and I have no idea why I called it that. Either way its not changing now. Inside the INI, you must make the section strings, by starting the INI with "[Strings]". Under this you can have any dynamic variables you want. Say you want it that $footer$ on every page is made to say "Compiled by Template It Build 3", you would put this line under the Strings section: "Footer=Compiled by Template It Build 3". So then your file would be:

[Strings]
Footer=Compiled by Template It Build 3

You can ALSO make a string refer to a file, but only files in the Info path - relative pathes are not treated different, it MUST be in the Info directory. If you wanted $footer$ to refer to Footer.txt, you would have the line "Footer=$Footer.txt", because $ means use file. If the file cannot be found, a standard error is put in place of its content. If you have Footer.txt in a directory called Global, you make the line "Footer=$Global\Footer.txt", like in website HRef's. If you need to make it so Footer shows up as "$'s are good", it will try to access a file called "'s are good", which will obviously fail. So, in fix to this issue, you can start the entry with the ^ symbol. When this is found at the start or end of an entry, it is removed. This was build in because I needed some entries starting with spaces and spaces are not counted if there is no text before them. Spaces at the end are not count either. If your require your entry to DISPLAY a ^, then do "Footer=^^ Whatever Else". Confused yet? Haha.

The Output Directory is where the final result is sent to...Simple, Huh?. The Auto Include directory is for files required in the root of the output directory, because this directory is cleared every compilation. This field is NOT required.

Recheck Statics isn't usually needed. If you have the site so that (lets just say) the 5th 'Dynamic Variable' contain $Blah$, the 1st dynamic variable, then all you need to do is move the 5th Variable to be higher in the chain than the ones it refers to. Or make them lower. Or you can tick the box. The latter will be slower in the long run.

And finally, the heart of Template It, the TI Script Path. This script tells TI what pages it needs to make and what content to give them, and what template to base them on. The script can have comments in it. Lines that are to be considered comments are begun with a hash (#). When working with, lets just say, the Basic template, you base all your pages on the Index.htm file in there. The templates can be named anything. A basic script you could use with the Basic template is:

#This script is BASIC :P
MakeFile Index.htm Index.htm "$Content$ = $IndexContent$" "$Title$ = Main Page"

This means make a page, call it index.htm (1st parameter). Use the Index.htm template (2nd parameter). Then we start the tag arguements. EACH tag arguement BEGINS and ENDS with a talking mark. $Content$ = $IndexContent$. This means that for the page being made, the Content tag will become the IndexContent tag. The 2nd tag arguement is giving the Main page it's title. For most templates, the Statics file should have StartTitle and EndTitle mentioned, because most templates use this. Say your site is called 'Wacko Wackers Wacky World', you could have

StartTitle=Wacko Wackers Wacky World - ^

(Notice the ^ because of the trailing space), and

EndTitle=^ - WWWW.com

This would cause the title of our index page to become "Wacko Wackers Wacky World - Main Page - WWWW.com". Nice? This means you can easily change the way your title appears on each page of your site by modifying one line. That is the idea of my program. You basically just expand on that. I have included an example of a site you can compile in the Docs folder of TI (where you found THIS?). Extract all the files first.

The latest sample templates can be found at www.lfi.net, but in the Docs folder of TI you will find a ZIP with the ones at the time of the last program update.