Conditional output in HTML templates

<< Click to Display Table of Contents >>

Navigation:  More Advanced Procedures > HTML Output and HTML Templates >

Conditional output in HTML templates

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 Open 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.

Click to expand/collapseConditional output reference
Click to expand/collapseTemplate conditional tags are hard-wired to the output format
Click to expand/collapseHow to use include options in HTML templates
Click to expand/collapseHow to use user-defined conditions
Click to expand/collapseUsing multiple conditions with OR or AND logic in HTML templates

See also:

HTML template output conditions (reference list)

Editing HTML templates

Variables in HTML templates