January 24, 2003.
Technical documentation on TreePad template files (.tpt and .hjt).
Contents
1 - Introduction
2 - Structure of a .tpt template file
3 - Structure of a .hjt template file
4 - Installing template files
1 - Introduction
TreePad supports two types of template files:
A - TreePad template (.tpt) files, which are used by TreePad Business Edition 6.0 and higher to insert XML-based template nodes ('TreeBook nodes') and forms into an existing database (using menu/tree/insert/special).
B - TreePad .hjt template files are used by TreePad PLUS, SAFE and Business Edition 6.0 and higher to create entire template-based databases including template nodes ('TreeBook nodes') and XML-based forms (using menu/file/new).
2 - Structure of a .tpt file
The TreePad template file format is text/ASCII based and contains two sections.
A - The first section contains XML data, defining a TreePad XML form.
B - The second section contains RTF, HTML or txt data, used for display in the template root node, but not in the forms themselves.
.tpt Example 1
5P9i0s8y19Z
{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fswiss\fcharset0 Arial;}}
\viewkind4\uc1\pard\b\f0\fs40 Music Collection\par
\par
\b0\fs20 By default, any descendant-node of this node will display the Music Collection form.\par
Music Collection also allows insertion of normal/standard TreePad nodes.\par
Please note that the text of this article can be altered in any way you like.\par
\par
}
Explanation:
The first part contains the XML template, defining the form.
The line 5P9i0s8y19Z closes the first part.
the second part is the RTF text, containing the text for display in the template node.
.tpt Example 2
5P9i0s8y19Z
By default, any descendant-node of this node will display the Music Collection form
Music Collection also allows insertion of normal/standard TreePad nodes.
Please note that the text of this article can be altered in any way you like.
Explanation
The first part again contains the XML template, defining the form.
The second part now contains plain text, without any RTF formatting.
Creating template files
The easiest way to create template files is to copy an existing template to a new file, then adjust that template's XML and RTF sections according to your needs.
3 - Structure of a .hjt template file
A .hjt template file is essentially a standard TreePad .hjt file, except that the root node is a template node. A .hjt template is used to create a new database, while a .tpt template is used to insert a new template node into an existing tree.
The article text of the template node (inside a .hjt template file) contains exactly the same information as can be found in a .tpt template file. To create your own .hjt template files, create a subtree of one root node into TreePad and save it. Then, using a text editor, replace the article text of the root node with the template data. More details on the template data can be found in the section on .tpt files in this document.
4 - Installing template files
To install a .tpt or .hjt template file, just copy it into the TreePad template directory, which is a subdirectory of the TreePad program directory.
Document created by: Henk Hagedoorn, Freebyte!
Almere, the Netherlands
http://www.treepad.com
http://www.freebyte.com
http://www.treepad.com/support