Go to main content

Else

Contents

Syntax

<txp:else />

The else tag is a single tag that is used within a containing conditional tag to provide the means to assign default, or alternative, behaviour when the condition in the surrounding tag is not met.

Visually, this is the general structure in which it is used:

<txp:if_conditional_tag>
    …Content if true…
<txp:else />
    …Content if not true…
</txp:if_conditional_tag>

Attributes

This tag has no attributes of its own. It accepts only the global attributes .

Examples

Example 1: Display excerpt when available

<txp:if_excerpt>
    <txp:excerpt />
<txp:else />
    <txp:section link="1" />
</txp:if_excerpt>

When the excerpt is available it is displayed, but when it is missing a hyperlinked section name is displayed instead.

Other tags used: excerpt, if_excerpt, section.

If you notice any kind of problem with this page's construction or content (outdated information, typos, broken links, or whatever), open an issue to have it sorted. Or have a go at it yourself. :)