You can use all global predefined variables and user-defined variables in all HTML templates. In addition to this there are a number of special HTML template variables, which are only relevant in HTML templates.
User-defined variables from your projects and skins are exported to a JavaScript object for reference in your scripts. See below for details.
In addition to these variables you can also use predefined and user-defined conditional switches to include or exclude content on the basis of conditions. This is particularly useful for variables, which are often only relevant in certain contexts. For details see Conditional output in HTML templates.
Key Information
When you are using a skin remember that variables can be stored either in your project or in the skin. However, if you create variables with the same name in both the project and the skin, the value defined in the skin will be used.
|
You can use all your user-defined variables in HTML templates, including HTML variables for inserting HTML code. Just type in the variable in the position where you want to use it in the standard format, complete with the opening <% tag and the closing %> tag.
Example:
...
<br /><br />
</IF_TOPIC_HEADER>
<br /><hr />
By: <%HELPAUTHOR%>
<br /><hr />
<%TOPIC_TEXT%>
</body>
</html>
The above example inserts the contents of the user-defined variable between horizontal rules above the topic text on every page.
|
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:
hmConfigVariables.PROJECTVERSION
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.
|
You can use both the global variables and the special HTML template variables. They are used just in the same way as user-defined variables. Just type them into the template in the position where you want to use them. Always type the variables exactly as shown in the variable lists, complete with the opening <% tag and the closing %> tag.
Example:
...
<%TOPIC_TEXT%>
<IF_HTML>
<br><br><hr><center>Page URL:
<a href="http://www.domain.com/help/index.html?
<%HREF_CURRENT_PAGE%>" target="top">http://www.domain.com/help/index.html?
<%HREF_CURRENT_PAGE%></a></center>
</IF_HTML>
...
The above example inserts the web URL of the current page at the bottom of every topic page in WebHelp. (This makes it easy for support staff to give users the address of specific help topics in the online version of your help.)
|
You can redefine both global and user variables in individual topics, by assigning a new value to the variable for the topic in Topic Options tab on the left of the main editor window. This is particularly useful for HTML templates because it enables you to insert individual code and text in your templates for on a per-topic basis. For example, you can reference different versions of JavaScript files in individual topics or insert individual texts in the head section of the page for search engine optimization.
1.Use your user-defined or global variables normally in your HTML template. (This is particularly useful for HTML variables!).
2.Select the topic where you want the variable to have a different value. Select the Topic Options tab on the left of the main editor window and add the variable and its new value in the Topic Variables section.
See The power of editable variables for more detailed instructions.
|
See also:
Editing HTML templates
Global predefined variables (reference list)
HTML template variables (reference list)
Conditional output in HTML templates
The power of editable variables