You can use all of Help+Manual's standard conditional output options in HTML templates, both your user-defined include options and options based on the current output format. In addition to this there are a few special conditional switches which are only for use in WebHelp output, because they are only relevant there. See the lists below for details.
These conditions are used to enclose blocks of HTML code in your template that you want to include in the output only if the condition is fulfilled. The condition tags themselves are never included in your output code, they are always stripped from the code before publishing.
Conditions based on the output format are only relevant in the HTML topic page templates which are used in HTML Help, WebHelp, Windows Exe and ePUB eBooks and Visual Studio Help. The TOC, search and keyword index templates are only used in WebHelp so it does not make sense to use format-based conditions there since the output format is always WebHelp.
If you are using an HTML skin you must edit your templates and settings in the skin!
Nowadays you will almost always choose an HTML skin to publish your project to WebHelp or HTML Help/CHM. A skin is a special kind of Help+Manual project without topics that only stores your HTML templates and all the settings relevant for HTML output to these two formats. When you choose a skin, the templates and settings in the skin completely replace those in your project.
Normally, a skin is pre-designed and you don't need to change anything. However, if you do want to change something, you must do all your editing in the .hmskin skin file. Editing in your Help+Manual project won't have any effect because those templates and settings are not used.
To edit a skin, make a copy of the .hmskin skin file in your project folder and then open it in Help+Manual by selecting .hmskin as the file type to open in the dialog. All the templates and settings are in the same places as in a normal Help+Manual project.
Exception: HTML Export Options
The HTML Export Options section is not stored in skins and needs to be edited in your project.
Conditional tags in HTML templates look very similar to the conditions you use for content in your project. However, there is one very important difference: In templates, the true/false status of the conditions is hard-wired to the output format and cannot be changed.
In the Publish screen you can include content tagged for other output formats than the one you are currently publishing to by activating the checkboxes for those formats manually. This has no effect on the conditional tags in your templates, however. This is very important, because in templates you will often want to exclude code that would cause errors in some output formats. If this wasn't the case, including content tagged for WebHelp in a CHM file the Publish screen could cause serious errors if that also included template code tagged exclusively for WebHelp in a CHM file.
Like most HTML tags each condition has an opening tag and a corresponding closing tag, using the same </ syntax to identify the closing tag as all regular tags. Simply enclose the code you want to include conditionally between the two tags.
Note that the ELSE condition is not available in HTML templates.
<font size="3">This text only appears in the topic if the topic has a <b>header</b>.<br><br>
It will not be included in popup topics, which never have a header, or in topics assigned
help window types defined without a header.</font>
<IFNOT_PREVIOUS_PAGE>This text will only be displayed in
the very first topic in your help.</IFNOT_PREVIOUS_PAGE>
<a href="<%HREF_NEXT_PAGE%>">Click here to jump to the next topic</a>
The last example only displays the link if there is a next topic to jump to.
Basically this is exactly the same as using the predefined include options, you just have to use the following syntax rules to create your conditional switches from the names of your include options in :
This example shows how to use the user-defined include options ALPHABUILD and BETABUILD:
This text will be included if ALPHABUILD is selected in the Include Options in the
Make Help File & Run dialog.
This text will be excluded if BETABUILD is selected in the Include Options in the
Make Help File & Run dialog.
If you want to allow for multiple conditions with OR or AND logic in your HTML templates you can do this as well.
Multiple conditions with AND logic
If you want to include content in a template only if multiple conditions are all true, you just need to nest the condition tags. Then the content inside the conditions will only be included if all the tags in the nesting chain are true. For example, suppose you want to include some code only if the output is a CHM file and the user-defined option CLIENT1 are both true:
This text will only be included if both CHM and CLIENT1 are true.
The order is irrelevant, but you must be careful not to "cross" the end tags. In the example above, both CLIENT1 tags must be inside the CHM tags.
Multiple conditions with OR logic
If you want to include content in a template if any one of multiple conditions is true you can include multiple conditions inside a single tag, separated by the | character.
Note that this does not work with IFNOT conditions, only with IF conditions!
This text will be included if any one or more of the 3 conditions is true.
Here too, the order is irrelevant, but you should use the same order in the start and end tags.
HTML template output conditions (reference list)
Editing HTML templates
Variables in HTML templates