Textpattern CMS structural tags help with the overall content structure of the site, and can be used to automate the presentation of material to the browser. In my previous article, I explained about the delightfully-simple `output_form` tag, along with a couple of examples of how to use it. For my fifth and final piece about structural tags, the subject is the Textpattern `yield` tag.
It essentially transforms `output_form` from a single tag into a container tag, and the `yield` part will return the contents of the container. Here’s a reminder of how `output_form` does its thing in its guise as a single tag:
<txp:output_form name="information" />
Simply, it processes the form given and outputs it to the browser where appropriate. Now, `yield` comes into play when `output_form` becomes a container tag. Consider this form referenced above — information — and it has the following (deliberately simple) content:
This is static content in the miscellaneous form called 'information'. <txp:yield />
The magic with `yield` happens when the single tag becomes a container, like this:
<txp:output_form name="information" /> …and this text is what's inside the container tag. </txp:output_form>
The output will be:
This is static content in the miscellaneous form called 'information'. …and this text is what's inside the container tag.
I’ve known about this tag since its introduction 5+ years ago. It’s a tag I’ve never had to use on a production website, but one that might tick a box for you.