Go to main content

If yield

Contents

Syntax

<txp:if_yield>

The if_yield tag is a conditional tag and always used as an opening and closing pair, like this…

<txp:if_yield>
    …conditional statement…
</txp:if_yield>

It tests the existence and/or value of a content set with the yield tag inside of an output_form container tag.

Attributes

Tag will accept the following attributes (case-sensitive) as well as the global attributes :

name="string" v4.7.0+
The (optional) name.
value="value"
The (optional) value which the yield content must match in order for the contained statements to be executed. If this attribute is omitted, the tag returns ‘true’ if the yield content is defined. If this attribute’s value is omitted (i.e. value="), the tag returns ‘true’ if yield content is defined, but has no value.

Examples

Example 1: Check if yield is defined

<txp:if_yield>
    Output_form was used as a container.
<txp:else />
    No yield defined.
</txp:if_yield>

Example 2: Check if yield content is set

<txp:if_yield value="">
    No yield, is empty.
<txp:else />
    Yield set: <txp:yield />
</txp:if_yield>

Other tags used: yield.

Example 3: Check against a specific yield content

<txp:if_yield name="color" value="red">
	Color is red.
</txp:if_yield>

Genealogy

Version 4.7.0

name attribute added.

Version 4.6.0

Tag support added.

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. :)