PCF/Packed Custom Fields
This plugin allows you to pack multiple values into one custom field—and to structure the packed values.
If you are a heavy user of custom fields this might be useful for you.
Includes a tag to allow the output of a TXP email link from part of a packed custom field.
Download
The current version and previous versions will be listed here.
- sed_packed_custom_fields.v0.3.108.gzip.txt [6.55KB]
<strong>Compressed (gzip) Version</strong> <ul> <li>Adds new tag <code>sed_pcf_for_each_value</code>.</li> </ul> : 1250 download(s)
- sed_packed_custom_fields.v0.3.108.txt [26.29KB]
<strong>Normal Version</strong> <ul> <li>Adds new tag <code>sed_pcf_for_each_value</code>.</li> </ul> : 1292 download(s)
- sed_pcf-0.2.zip [17.70KB]
v0.2 of the PCF plugin. : 939 download(s)
- sed_pcf-0.1.zip [14.83KB]
v0.1 of the Packed Custom Field plugin. : 674 download(s)
PCF Manual
sed_pcf plugin, v0.2 (June 11th, 2006)
This little plugin allows you to use an article’s custom fields to store multiple, named, values. The packing must follow a specific format. The tag list includes tags to test for a value in the field and to access a value from a field.
Tag Directory
Tag | Description |
---|---|
code>sed_pcf_get_value | Returns the named value from the named section of the named custom field. |
code>sed_pcf_if_value | Tests for the existence of a named value in a named section of a custom field. |
code>sed_pcf_if_field_section | Tests for the existence of a named section of a custom field. |
code>sed_pcf_email | Uses the values in a named section of a custom field to call the TXP email tag. |
code>sed_pcf_image | Uses the values in a named section of a custom field to call the TXP image tag. |
code>sed_pcf_thumbnail | Uses the values in a named section of a custom field to call the TXP thumbnail tag. |
sed_pcf_for_each_value | Uses the values in a named section of a custom field to call the TXP thumbnail tag. |
The get_value
tag
This tag can take the following attributes…
Attribute | Default Value | Status | Description |
---|---|---|---|
‘custom’ | ‘’ | Needed | Name of the custom field to access. |
‘section’ | ‘’ | Needed | Name of the section within the field to access. If you are using the simple packing format then set this to ‘none’. |
‘variable’ | ‘’ | Needed | Name of the variable within the section. |
‘default’ | NULL | Optional | The value to return if the access fails. |
Emphasized items have been added or changed since the last release.
Struck out items have been removed since the last release.
The if_value
tag
Attribute | Default Value | Status | Description |
---|---|---|---|
‘custom’ | ‘’ | Needed | Name of the custom field to access. |
‘section’ | ‘’ | Needed | Name of the section within the field to access. If you are using the simple packing format then set this to ‘none’. |
‘variable’ | ‘’ | Needed | Name of the variable within the section. |
‘val’ | NULL | Optional | If specified, this value will be checked against the named variable from the named section of the named custom field. |
If the value is present and equal to a suppled val
then the contents of the contained tag will be evaluated. If there is an else
section then that will be evaluated if the value is not present or if it is present and fails to match the val
attribute.
The if_field_section
tag
Attribute | Default Value | Status | Description |
---|---|---|---|
‘custom’ | ‘’ | Needed | Name of the custom field to access. |
‘section’ | ‘’ | Needed | Name of the section of the packed field to test for. |
If the named section exists within the named custom field then the enclosed part of the tag is parsed.
The email
tag
Attribute | Default Value | Status | Description |
---|---|---|---|
‘custom’ | ‘’ | Needed | Name of the custom field to access. |
‘section’ | ‘email’ | Optional | Name of the section within the field to grab the values to pass to the TXP email tag.If you are using the simple packing format then set this to ‘none’. |
‘default’ | NULL | Optional | The value to return if the access fails. |
‘parse’ | false | Optional | Set this to true to force a the contents of the packed field to be parsed before being used to call the TXP email function. This means that it is possible to use attributeless tags (such as <txp:s/> as arguments to the email call. |
Allows you to setup email links on a per-article basis. You need to setup the custom field you are going to stash the email values in. Then add this to the article body or article form <txp:sed_pcf_email custom='my_field_name'/>
. Replace the ‘my_field_name’ as needed.
Next, in the custom field itself, make sure you have email(email='a
b.c’;linktext=‘foo’;title=‘bar’)@. Replacing the values as you need.
The image
tag
Attribute | Default Value | Status | Description |
---|---|---|---|
‘custom’ | ‘’ | Needed | Name of the custom field to access. |
‘section’ | ‘image’ | Optional | Name of the section within the field to grab the values to pass to the TXP image tag.If you are using the simple packing format then set this to ‘none’. |
‘default’ | NULL | Optional | The value to return if the access fails. |
Allows you to display an image based upon the contents of a section of a packed custom field. If you want to use a second layer of tags then that is possible providing they are attributeless tags such as <txp:author/>
or <txp:s/>
.
The thumbnail
tag
Attribute | Default Value | Status | Description |
---|---|---|---|
‘custom’ | ‘’ | Needed | Name of the custom field to access. |
‘section’ | ‘thumbnail’ | Optional | Name of the section within the field to grab the values to pass to the TXP thumbnail tag.If you are using the simple packing format then set this to ‘none’. |
‘default’ | NULL | Optional | The value to return if the access fails. |
As for images, so with thumbnails!
The for_each_value
tag
This can be used as an enclosing tag, or with a form, or as a single tag. It was inspired by the wet_foreach_image plugin and works in a very similar manner.
Attribute | Default Value | Status | Description |
---|---|---|---|
‘name’ | ‘custom1’ | Needed | Name of the custom field to access. |
‘debug’ | 0 | Optional | Set to 1 to output extra debug info |
‘form’ | ‘’ | Optional | Form to use to format output |
‘label’ | ‘’ | Optional | Label text for the output |
‘labeltag’ | ‘’ | Optional | tag for the label |
‘wraptag’ | ‘ul’ | Optional | Tag to wrap the whole output in — you might want to set this to ‘’ if using a form. |
‘break’ | ‘li’ | Optional | Tag to wrap each individual value’s output in — again, you may want to set this to ‘’ if your form wraps the output. |
‘class’ | ‘custom1’ | Optional | Class to apply to the wrapped output |
This tag can be used in three ways…
- As a single tag with default layout…
<txp:sed_pcf_for_each_value />
- As a single tag using a form for layout…
<txp:sed_pcf_for_each_value form="your_form" />
- As an enclosing tag…
<txp:sed_pcf_for_each_value>... your stuff here...<txp:sed_pcf_for_each_value />
The enclosed section, default or supplied form will get parsed once per value in the custom field’s list.
On each parse, the string '{value}'
will be replaced by the corresponding value from the custom field.
The default layout, used in the absence of a form or contained section, is ‘{value}’.
Field Formats
There are three formats you can use in your custom fields.
ForEach Format.
This format can only be used by the sed_pcf_for_each_value()
tag. It’s a simple comma seperated list of values…
- a,b,c,d,g
Simple Format
This is a list of name=‘value’ pairs, separated with ‘;’ characters. Some examples of valid formats would be…
- a=‘1’
- a=‘1’;b=‘2’
- name=‘Steve’;website=‘http://txp-plugins.netcarving.com’
If you want to use the simple format then set the section name to ‘none’ when you call the tags.
Normal Format
This allows you to pack mutliple sets of the simple-format lists into one field. Each list is called a section and sections can be named, and separated with the ‘|’ character.
Some examples of valid fields…
- section1(a=‘1’;b=‘2’)|section2(c=‘Hello!’;d=’‘;e=‘Goodbye!’)
- copyright(start=‘1945’;owner=‘Ritchard the great’)|email(email=‘john@nowhere.splat’;linktext=‘link text’;title=‘Click here to send a message’)
Version History.
v0.2 Implemented the following features…
- Added the simple field format
- Added value checking to the
sed_pcf_if_value
tag - Added the
sed_pcf_if_field_section
tag - Added tags to display thumbnails and images from packed custom fields
- Added parsing of embedded values to allow the use of attributeless tags as arguments to the image, thumbnail and email tags.
v0.1 Implemented the following features…
- Basic retrieve and test of packed values from a custom field.
- Tag to build a TXP email link from a section of a custom field.