Content last modified Tuesday 24 August 2021
hop to #bottom
Categories:
Author:
Current version:
1.0
About It:
Get it:
Rate it:
  • Helpful?
  • 2 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!

aam_split_custom_field

This plugin lets you collect related pieces of information into a single field, pull one or more of them back out again, and create conditional content based on individual values in the collection.

The collections themselves are simple string-delimited lists — easy to create, but flexible enough to accomplish some interesting things. With the aam_split_custom_field template tag, you can extract and output a single value or several successive values from the field using your choice of HTML markup. For example, you can turn a delimited custom field into a bulleted list or a series of paragraphs. The aam_if_scf conditional tag does comparisons against individual values from the delimited field. You can see some examples in this blog post, and full documentation is available in the plugin’s help.

NOTE: requires version 4.0.4 or higher

This Sounds Familiar…

This plugin serves a similar purpose to Steve Dickinson’s sed_pcf “packed custom fields” plugin. So why make anther plugin, and which one is better for you?

  • This plugin has a simpler syntax for custom field data than sed_pcf, but sed_pcf lets you give data greater structure.
    • Consider using aam_split_custom_field when highly structured data is unnecessary, or when novice users will be maintaining the site.
    • Consider using sed_pcf when structured data is important, or for sites with more advanced users.
  • This plugin offers a convenient way to generate marked-up output from several successive values in a list; sed_pcf lacks a similar feature, but lets you pick and choose specific values by name.
    • Consider aam_split_custom_field when dealing with lists or collections of a fairly general nature (e.g. product features).
    • Consider sed_pcf when data is more specialized (e.g. product color, size, price, etc.).

Although I haven’t tried, it should also be possible to work with both plugins on the same site. You can use sed_pcf for some custom fields, and aam_split_custom_field for others.

Important Update!

Forward-compatibility note: The behavior of the plugin’s conditional tag will be changing in the next release. It will become possible to compare a user-specified string against every item in the delimited field (instead of just one selected item). This feature will be invoked by omitting the offset attribute or explicitly setting it as empty. That’s a change from the current behavior, which has offset defaulting to 0. If you use the conditional tag in production, I recommend specifying the offset attribute, even when you intend it to be 0.

Article Request Count:
Keywords/tags:
Initially released:
12/30/2007
Posted here:
30 Dec 2007

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