Please enable JavaScript to view this site.

Navigation: Reference > Project Structure & Templates > HTML Templates

HTML Template Output Conditions

Scroll Prev Top Next More

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 Help+Manual's WebHelp output, because they are only relevant there. See the lists below for details.

These conditions are like special HTML tags. They 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.

In HTML templates you can only use output format conditions for HTML-based output formats (CHM, HTML, EBOOK and HXS). This is because these templates are only used for HTML-based output so <IF_PDF> would not have any meaning, for example. Note that the EBOOK condition applies both for Windows Exe and ePUB eBooks.

Conditions are stripped before publishing

All the condition tags are stripped from your code before actually generating the HTML output. No proprietary tags are included in your output!

Conditional tags in templates are hard-wired to the output format

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.

Combining conditions with AND and OR logic

You can combine conditions to achieve AND and OR logic if necessary. For AND you need to nest two sets of conditons, for OR you combine the conditions in a single tag.

Nesting conditions for AND logic

If you only want to include content when multiple conditions are all true you need to nest them like this:

<IF_HTML><IF_TOGGLES> ... </IF_TOGGLES></IF_HTML>

The above conditions will only include the content between the tags if the output format is WebHelp and there are toggles on the current page.

Combining conditions for OR logic

If you want to include content if any one of multiple conditions is true you combine them in a single tag separated by the | pipe character.

Important: Note that this does not work with IFNOT conditions, only with IF conditions!

You can use this feature like this:

<IF_CHM|TOGGLES> ... </IF_CHM|TOGGLES>

The above condition will include the content between the tags if the current format is CHM or if there are toggles on the page, or if both are the case.

Predefined HTML template conditions:

In addition to the predefined conditions listed here you can also use your own user-defined include options as conditions in HTML templates. See Conditional output in HTML templates for details on how to use the conditions.

Conditions

Function of the condition

<IF_CHM>

True when you generate HTML Help/CHM.

<IF_EBOOK>

True for eWriter/Windows EXE eBooks (false for other eBook types).

<IF_EPUB>

True for ePUB and Kindle/Mobi eBooks (false for eWriter Help).

<IF_FRAMES>

True if WebHelp is exported with frames (a frame-based format is selected in the Navigation options). This could be used for entering a link from topic pages to your TOC page when you select the No Frames, No Scripts layout option, for example. Only relevant for WebHelp.

<IF_GA4ACCOUNT>

True if the setting for your new Google Analytics 4 (GA4) Google Analytics account is not empty.

<IF_GAACCOUNT>

True if the setting for your old Universal Analytics Google Analytics account is not empty.

<IF_HTML>

True when you generate WebHelp (HTML)

<IF_HXS>

True when you generate Visual Studio Help (2008 or 2010)

<IF_INDEX_PAGE>

True if a keyword index is included in the output. For example, you could use this to exclude a link to the index page from the TOC page if the keyword index is not included. Only relevant for WebHelp.

<IF_NEXT_PAGE>

True if a next page exists. Used to suppress or display a grayed-out version of the Next button in the very last topic. Can only be used in topic page templates.

<IF_PREVIOUS_PAGE>

True if a previous page exists (the variable <%HREF_PREVIOUS_PAGE%> is not empty). Used to suppress or display a grayed-out version of the Previous navigation button in the very first topic. Can only be used in topic page templates.

<IF_SEARCH_PAGE>

True if full-text search is included in the output. For example, you could use this to exclude a link to the search page from the TOC or keyword index page if the search function is turned off. Only relevant for WebHelp.

<IF_TOGGLES>

True if the current topic contains one or more toggles (expanding text and images). Can only be used in topic page templates.

<IF_TOPIC_BREADCRUMBS>

True if the <%TOPIC_BREADCRUMBS%> variable is not empty (see HTML template variables). For example, this variable is always empty in topics in the Invisible Topics section and in top-level topics. Can only be used in topic page templates.

<IF_TOPIC_HEADER>

True if the current topic has a header and the header is not empty (the variable <%TOPIC_HEADER%> is not equal to ""). Can only be used in topic page templates.

<IF_TOPIC_PICTURE>

True if the current topic has a featured image associated with it. You can then use this to insert the image. Can only be used in topic page templates.

<IF_XHTML>

True if XHTML 1.1 output is activated in your HTML Export Options. You will generally only need this in reusable skins, when the skin may be used for projects published with either normal HTML or XHTML.

 

"IFNOT" versions negate the meaning of the conditions:

Exclude Conditions

Function of the exclude condition

<IFNOT_CONDITIONNAME>

Negates the positive version of the condition. Content between the condition tags is only inserted if the condition is not true. Available for all conditions.

See also:

User-defined include options

Using HTML Templates

Conditional output in HTML templates

Help Windows