If yield

On this page:



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

    …conditional statement…

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


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

name="string" v4.7.0+
The (optional) name.
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.


Example 1: Check if yield is defined

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

Example 2: Check if yield content is set

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

Other tags used: yield.

Example 3: Check against a specific yield content

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


Version 4.7.0

name attribute added.

Version 4.6.0

Tag support added.

See something wrong in this document? Outdated info, a broken link, faulty code example, or whatever? Please open an issue and we’ll investigate.