Variables in HTML templates

<< Click to Display Table of Contents >>

Navigation:  More Advanced Procedures > Using Variables >

Variables in HTML templates

The HTML templates that generate the pages in Help+Manual's HTML-based output formats (HTML Help, WebHelp, Windows Exe and ePUB eBooks and Visual Studio Help) make extensive use of variables. You can use all global predefined variables and all your user-defined variables in your HTML templates

There are also a number of special predefined variables for use in these templates only. For details on these variables and how to use them see Variables in HTML templates.

User-defined variables in HTML templates and skins

In WebHelp, all your user-defined variables are exported as JavaScript variables in a .js file called hmvariables.js. This file combines both the user variables defined in your project and those defined in your WebHelp skin, if you are using one. If the same variable is defined both in your project and your skin the definition in the skin takes precedence and gets exported to the .js file.

You can make these variables available for use in your scripts in your templates by loading this file prior to referencing the variables, like this:

<script src="hmvariables.js"></script>

The variables are stored in an object called hmConfigVariables  and the variables themselves are stored in all upper case. So if you have a variable called PROJECTVERSION you would reference it as:


The values are always strings. If you want to use the values as numbers, Boolean values etc. you need to convert them before using them.

HTML variables in HTML templates and skins

HTML variables are primarily designed for use in HTML templates and HTML code objects you can use them in other locations but then only the text portion of the variable value will be inserted.

The code stored in the HTML variable must make sense in the template, of course, you are entirely responsible for that!

Don't edit HTML templates if you don't understand HTML!

Any changes you make to the HTML templates are not checked for plausibility or syntax errors. You are entirely responsible for all the code you enter and all the changes you make. Making changes to the template code without knowing what you are doing can cause serious errors and malfunctions.

See also:

Using HTML Templates

Variables in HTML templates

Conditional output in HTML templates

The power of editable variables

Variables and Conditional Output (Reference, lists of available variables and conditions)