Content last modified Monday 6 March 2017
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
Article modified:
04 Jan 2011

If there is a comment form at the Information URL, you may want to leave your comments/questions there for quicker feedback. Otherwise, comment away:

Your comment will NOT be submitted until you click the 'Submit' button on the next pageload.

Subscribe to this article's comments RSS feed. [ ? ]   View Recent Comments across the site.

You know you want to visit the Archives.

Browse

Categories


Articles

There are also tag clouds, 'cause those are fun.
Published with Textpattern