Navigation:  More Advanced Procedures > Templates in Help & Manual >

Content templates for topics

Print this Topic Previous pageReturn to chapter overviewNext page
Show/Hide Hidden Text

A topic content template is an XML file containing the "framework" of a topic it is used to create topics with repetitive content, for example identical tables and headings and so on.

Topic content templates can contain everything that a topic can contain, including tables, formatted text, graphics, links and so on. You can create as many content templates as you like and load them with you create topics with standard layout that you use repeatedly. You can also create content templates that are loaded automatically when you create new topics.

How to create a topic content template
1.Create a new topic. The topic ID is irrelevant because you are going to delete the topic as soon as you have saved the template.
2.Edit the topic and add everything that you want to have in the template. You can use all the features that you can use in a normal topic, including tables, graphics, formatted text, hyperlinks and so on.
3.Enter the topic header (in the area above the editor, not in the TOC) exactly as you want it to appear in the topic. See the instructions below for automatically inserting the TOC caption in the header.
4.Select File > Save Topic to File in Project > Manage Topics and save the topic as an XML file in the project folder, using the following naming syntax:

filename.template.xml

The .template. part of the name is essential, it identifies the XML file as a template. Templates must be stored in the current project directory and must use this naming syntax.

Examples:

intro.template.xml
functiondocs.template.xml
standarddocs.template.xml

5.Delete the topic you have just created if you don't want to use it in your project now.
How to use topic content templates

To create a new topic with a template:

1.Choose one of the Add Topic options in the Project tab to create a new topic.
2.Select the template in the Topic Template: field of the Insert New Topic or Chapter dialog.

Note that the template will only appear in the Topic Template: field for selection if it is stored in your project directory using the filename.template.xml naming syntax (see above for details).

To load a template into an empty topic:

1.Create an empty topic.
2.Select File > Load Topic from File in Project > Manage Topics and select the template file you want to load.

Don't try to load a template into an existing topic, this will overwrite the entire contents of the topic!

Insert the TOC caption in the topic header

When you create topic templates to use for creating new topics you can include a special variable in the header that will automatically insert the topic caption (the title of the topic you enter in the Add Topic dialog) in the header of the topic. If you don't use this variable the template will be loaded with the header saved with the topic.

1.Delete the header of the template topic (in the area above the editor, not in the TOC) and replace it with the following variable:

%TEXT%

2.Type in the variable manually exactly as shown, using all upper case. Only enter % and % before and after the variable name. This is the only variable that does not use <% and %> tags.

You can also include other text and elements in the header, including graphics. Only the variable is replaced when a new topic is created.

This only works when you create a new topic with a template. The %TEXT% variable is not translated when you load the template into a empty topic with File > Load Topic from File in Project > Manage Topics.

Topic content templates for topic styles

If you frequently use topics with different standard styles you could create a separate template for topics with each set of styles already preset in the topic header and body. Then you just need to select the appropriate template when you create a new topic (see above).

See also:

Creating new topics

Exporting and importing topics

 


Page url: http://www.helpandmanual.com/help/index.html?hm_advanced_templates_topicscontent.htm