rah_output_section_form

Published under current TXP projects

The plugin outputs section and category based forms. Textpattern’s output_form tag with a build in context and fallback support. No worry about long conditionals, no debugging notices singing tales about missing forms.

Download rah_output_section_form v0.5

Image: rah_output_section_form

Image: rah_output_section_form

List of features

Attributes

The tag is <txp:rah_output_section_form /> and attributes for it are as follows.

prefix
The prefix added to the searched form name. The prefix will prefix the section or category. If the prefix is set as delicious- (i.e. prefix="delicious-"), on pancake section page, the search form would be named as delicious-pancake. If the form is found, it’s used and used to replace the tag. If not, the fallback defined is used instead.
Default: prefix="s-" Example: "content_"

suffix
The suffix added to the searched form name. The suffix is appended to the form name. Same rules apply as to prefix (see prefix above). By default suffix is unset (empty).
Default: suffix="" Example: "-x"

type
Sets which context data is used to build the searched form name. The tag supports categories and sections. Available values are s and c, and longer counterparts, category and section. By default the tag will output section form.
Default: type="s" Example: "c"

default
Sets the fallback form used when the searched context-sensitive form isn’t found. The value should be the name of the form which you want to use as the default fallback. If unset (empty, the default), default form isn’t used.
Default: default="" (unset) Example: "my-default-form-name"

Example

Following snippet outputs contents of a form named as section_SectionName, where “SectionName” is the name of the current section, i.e. default or news.

<txp:rah_output_section_form prefix="section_" default="theform" />

On section “about” it will output form named as section_about, on “blog” section_blog, on “links” section_links and so-on.

Changelog

Version 0.5

Version 0.4

Version 0.3

Version 0.2

Version 0.1