htp on-line reference : Files

Table of Contents
  > Files
  HTP Tags
  Wish list

Using default files

Often you want to use the same templates, the same options, and the same macros in all htp files in a certain project. To support this htp parses a default file that can contain the necessary template, macro definitions. It can also include other htp files.

At program start, htp will look for an environment variable called HTPDEF. This variable can be set to a specific file. htp will load in this file and process it like any other, except that htp will not generate any output from it. In other words, it will only cull macros, options, and other settings. Plain text and other HTML markups will be ignored and shouldn't be present in this file.

htp will then search the current directory for a file named "htp.def". This file, called the project default file, is also processed like the HTPDEF file.

The file "htp.def" should contain all macros, metatags (see next section), options and templates common to all files in the directory. That is, if you organize your HTML file groups in separate directories, each directory has it's own project default file with settings and macros particular to that project.

The use of a global HTPDEF file instead of project default files makes it difficult to share projects with other people, as they would need the same global configuration. Using it is therefore deprecated by now.

Organizing your files

htp has been designed to break apart two components required to HTML files: design and content. This is good as it allows you to change your design without having to touch the content and to add new content without having to think about the design.

The design of your pages is best kept in a template file as seen in the last section. As mentioned earlier these reference manual is also created from a template file.

Page content should be held in separate files, each using [ref] file include or template to point to a template file. By using global and project default files and keeping logical groupings of subject matter in separate directories, this dissection of design and content becomes quite natural.

Although htp does not enforce any file naming conventions, I've adopted the following file extensions for my own sanity:

Content file defining macros containing the textual content. The macros are expanded by the template file.
Template file describing page layout.
Include file holding common macros and setting options.
Include file holding common content (when included from htp files) or common layout parts (when included from templates).

So much about files. In the next section you can learn how to customize htp to your own needs by defining your own tags.

  page source
  htp project
  htp homepage
hosted by
HTML coding Powered by htp
htp on-line reference /
Authors: Jim Nelson, Jochen Hoenicke, Michael Möller.
Maintainers: Jochen Hoenicke.

Copyright © 1995-96 Jim Nelson.
Copyright © 2001-2003 Jochen Hoenicke.
Permission to reproduce and distribute this hypertext document granted according to terms described in the License section.

last updated Tue Feb 22, 2011