# htp on-line reference : Files

## 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 this reference manual is also created from a template file.

Page content should be held in separate files, each using `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:

.htp:
  Content file defining macros containing the textual content. The macros are expanded by the template file.
.htt:
  Template file describing page layout.
.def:
  Include file holding common macros and setting options.
.hti:
  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.

hosted by Sourceforge HTML coding

Copyright © 1995–96 Jim Nelson. Copyright © 2001–2014 Jochen Hoenicke. Permission to reproduce and distribute this hypertext document granted according to terms described in the License section. last updated Sat May 16, 2015