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.
Image: rah_output_section_form
List of features
- Offers context sensitive building blocks.
- Seamless way to output forms used to host section based content and snippets, i.e. forms like
meta-MySectionNameorsidebar-MySectionName.
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
- Updated included help file.
Version 0.4
- Added: txp:yield support.
- Added:
suffixattribute. Thank you for the suggestion Jakob. - Added: Now caches the forms.
Version 0.3
- Added attribute:
type. - Added category support.
Version 0.2
- Fixed minor doSlash bug (didn’t effect anything).
- Added
defaultattribute.
Version 0.1
- First release.