Content last modified Tuesday 24 August 2021
hop to #bottom
Categories:
Author:
Current version:
0.9
About It:
Get it:
Rate it:
  • Helpful?
  • 0 Yes
  • 0 No
Flag it:

If you'd like to provide updated information and do not have access to directly edit, please contact the site admin; thanks!

atb_if_form

Lately, I’ve been writing Textpattern pages for relatively complex sites that do things like this:

<txp:if_section name="widgets,sprockets,thingies">
    <txp:hide>The widgets, sprockets, and thingies sections have their own special layouts.</txp:hide>
    <txp:output_form form='content-<txp:section />' />
<txp:else />
    <txp:hide>All the other sections look pretty much the same.</txp:hide>
    <txp:output_form form='content-default' />
</txp:if_section>

This plugin is designed to simplify this somewhat, and eliminate that list of section names (which is just one more thing for me to forget to update when I change the site).

atb_if_form

A simple, hopefully self-explanatory conditional form:

<txp:atb_if_form name="someform">
	<p>someform exists.</p>
<txp:else />
	<p>someform doesn't exist</p>
</txp:atb_if_form>

atb_output_form_if_exists

Can be used exactly the same way as the built-in output_form tag, except it doesn’t raise an error if the form provided doesn’t exist:

<txp:atb_output_form_if_exists form='foo-<txp:section />'>
    This text will be available via the txp:yield tag in foo-[section].
</txp:atb_output_form_if_exists>

It can also be used with a txp:else tag:

<txp:atb_output_form_if_exists form='foo-<txp:section />'>
    This text will be available via the txp:yield tag in foo-[section].
<txp:else />
    <txp:output_form form="foo-default" />
</txp:atb_output_form_if_exists>

You can also follow this on GitHub.

Article Request Count:
Initially released:
31. May 2010
Posted here:
31 May 2010

You know you want to visit the Archives.
Published with Textpattern