Session 1

Templating.

Basic hitop.

Hitop can be used, at the most basic level, as a templating program - you write a generic page layout, and hitop will plug in the actual content for you. (No, it won't write the content for you...) This may be the simplest use of hitop, but it certainly shouldn't be overlooked - if you want to change the design of an entire site, you just need to change the template files and run hitop! So, lets create our first template, and the obligatory Hello World example.

My first hitopped page.

Right, the first thing we have to do is write the template. Remember I said you needed to know HTML? I wasn't kidding... Here is an example of a template:

<HTML>
<HEAD>
<TITLE>
<@GET NAME="pagetitle">
</TITLE>
</HEAD>
<BODY>
<H2><@GET NAME="maintitle"></H2>
<BODYTEXT>
</BODY>
</HTML>

The astute among you will have recognised some basic HTML. You should also have noticed there are some odd bits... The three tags that are different are <@GET NAME="pagetitle">, <@GET NAME="maintitle"> and <BODYTEXT>. (Incidentally, it doesn't matter if BODYTEXT is in caps or lower case - but caps makes it easier to keep track of.) Fire up your favourite text editor (pico is nice for muppets like me) and type the example into it. Save this file as template.hitop.

Lets create a file with the data for the page in it now, and the tags should start to make sense.

<@SET NAME="pagetitle" VALUE="A hitopped page!">
<@SET NAME="maintitle" VALUE="Here's Johnny...">
<@DEF NAME="bodytext">Hello world!</@DEF>
 
<@FILE SRC="template.hitop">

You can see that some of these tags match up with the previous template: @GET matches with @SET, while the <BODYTEXT> tag would seem to be associated with the @DEF bit.

There is also another tag here: the @FILE tag. This tells the hitop program where the template for this source file is. (If you're wondering, the tags start with @ to prevent conflicts with future HTML tags.)

Save this file as hello.hitop and we will move onto the exciting final step: creating the page!

You should now have two files in your directory. One is template.hitop, one is hello.hitop. Hopefully, these will be in your public_html directory, or a sub-directory, so that you can view the page when we finish...

Now, at the command prompt, type:

hitop hello.hitop

If all has gone well, you should get a new command prompt, and nothing else. If there are any problems, hitop will tell you. Now there should be a third file in the directory, hello.html. Check and see. If it is there, fire up your web browser and take a look.

It should look something like this example.

Next, I'll explain more about those tags.