![]() htp on-line reference : Templates |
|
htp allows for templates to be used, where one file defines a standard
layout scheme that can be reused for any number of documents. Templates
are not a feature per se, but is available by utilizing several
of htp's features.
Below is a simple htp template file. The tags are hyperlinked for convenience.
<OPT IMGXY QUIET> <IF title> <SET pagetitle=$title> <ELSE> <SET pagetitle="Default title"> </IF> <HTML> <HEAD> <TITLE> <USE pagetitle> </TITLE> </HEAD> <BODY> <H1> <USE pagetitle> </H1> <P> <HR> <P> <USE body> <P> <HR> <P> </BODY> </HTML>
The first tag, OPT, sets options that are used for the rest of the document.
The second block of tags, defining the
The only other macro that must be defined by the page is the So, a simple document could do this:
<FILE TEMPLATE="template.htt"> <SET title="A Simple Page"> <BLOCK body> This is some simple text that will be expanded in the BODY section of the HTML file. </BLOCK> Other documents could be constructed using a similar format. When htp parses and processes the documents, they will be completely expanded and ready to be served up onto the Web. And, since one file contains all layout information about the document, if this simple template were to be spruced up with graphics or additional formatting, only one file needs to be changed. Templates are not only useful for defining complete documents. They can also be used for defining a small formatted portion of the HTML file. For example, if a page wanted to include a drop quote (where a short sentence is quoted in larger characters in the middle of an article), a drop quote template file could be created.
<HR> <H1 ALIGN=CENTER> <USE dropquote> </H1> <HR>
The macro
|
|
htp on-line reference / http://htp.sourceforge.net/ref/
Authors: Jim Nelson, Jochen Hoenicke, Michael Möller. Maintainers: Jochen Hoenicke, Michael Möller.
Copyright © 1995-96 Jim Nelson. last updated Mon May 27, 2002 |