An ahab Primer

Let’s look at a simple example of a template file:

<HTML><HEAD><TITLE>This is our template title</TITLE></HEAD>
<BODY BACKGROUND="back.jpg">
<H1>This is our template header</H1>

<!plainHTML>

<HR>
Thanks for visiting our page!<BR>
</BODY></HTML>
This is the basic format of a template file. Every output file generated by ahab with this template file will include the header and footer information you see above.

<!plainHTML>
This line requires some explanation. This is what is known as an "ahab tag". It tells ahab to perform a special function. This particular tag tells ahab that whatever non-template ("plain") HTML there is in the input file, it should go at this location in the output file.

For instance, you might have a (very) plain HTML file that looks like this:

Hi, this is a plain file.
And when I say plain, I mean REALLY plain.
If you ran ahab using these template and input files, the output file would look like this:

<!templateHTML>
<HTML><HEAD><TITLE>This is our template title</TITLE></HEAD>
<BODY BACKGROUND="back.jpg">
<H1>This is our template header</H1>

<!plainHTMLstart>
Hi, this is a plain file.
And when I say plain, I mean REALLY plain.
<!plainHTMLend>

<HR>
Thanks for visiting our page!<BR>
</BODY></HTML>
See, we’re making your job easier already.

You may have noticed that ahab inserted a few of its own tags into the output file. This is so the output file can later be used as an inputHTML file, and ahab will still perform correctly.

<!templateHTML>
This tag appears at the top of all ahab output files. It's actually a signal that the file already has template information in it, so if ahab is run again on this file, it should replace the template code instead of adding it.

<!plainHTMLstart>
<!plainHTMLend>
Similarly, these tags tell ahab what part of the file to "leave alone", if its ever used again as an input file. Remember, ahab only cares about template code. You can put whatever you want in the “meat” of your pages.

Using this example, if you changed the template so the <BODY> tag read:

<BODY BACKGROUND="newback.jpg">
...and then ran ahab again with the new template file and the new input file (which was actually the old output file), the new output file would reflect that change. If you had a number of different files using the same template, you could change them all by supplying the file extension to ahab instead of a specific filename. It's so simple, it just might work.

You now know enough to go ahead and start putting ahab to work for you. Go try a few tests. If you have an existing website, try making a template file for it, and see if you can add a new page to the site a whole lot faster than you used to.

Back to main ahab page

Pinback's Web Central
This page and the contents therein (except where otherwise attributed) are copyright (c) 1997, 1998, by Ben Parrish.
That was in case any of you devious types were thinking of stealing all my cool stuff. So there.
[ Lynx Now! ] This page is Lynx Enhanced, and here's why.
[ OWL Approved! ] This webpage adheres to the specifications set forth by the Optimal Web Layout (OWL) Committee.