You are not logged in.
PCF = Packed Custom Fields
Here’s a link to the PCF homepage.
There has been a bit of talk on the forum recently about custom fields and their various uses for per-article data. So I figured I’d throw this into the arena.
This plugin allows you to pack multiple values into one custom field—and to structure the packed values into “sections” which, for this purpose, are just a named group of packed values. There are tags for use in article forms to allow you to test for the existence of a named value in a section (and to test for equality with a given value) and also to access values by section + name.
If you are a heavy user of custom fields and are starting to run out then this might be useful—no need to resort to hacking TXP to get more fields! (Apparantly it does work with the extra custom field hack too!)
It also includes a tag to allow the output of a TXP email link from part of a packed custom field.
I haven’t included tags for building
script sections or linked style sheets for the page header as Bastian covered that with his little plugin.
sed_pcf_for_each_valuewhich will iterate over a field in CSV format and parse the given form (or the contained contents of the tag) once for each value in the field.
There are now three possible field formats: CSV, simple format and full format.
Simple Format goes like this… nameA=‘valueA’;nameB=‘valueB’;nameC=… etc. It takes up the entire custom field.
You can create named “sections” in a custom field and store multiple name=‘value’ pairs within each named section.
In abstract form you do this:
And a concrete example would be:
copyright(owner='King Harold';start='1066')|email(email='king.hhastings.org.uk’;linktext=‘King Harold’)@
You could then test for values in your article/misc forms like this…
<txp:sed_pcf_if_value custom='your_custom_fieldname' section='copyright' variable='owner'>
© <txp:sed_pcf_get_value custom='your_custom_fieldname' section='copyright' variable='owner'/>
... your default stuff here.
Watch out though, custom fields are varchar(255) in the TXP tables so don’t use strings that are too long (unless you use phpMyAdmin or some such tool to change the field format)
I hope you find it useful.
Please feed back with ideas/bugs.
Last edited by net-carver (2008-01-02 08:03:22)
V0.2 out now…
This is exactly what I was looking for! Thank you so very much.
This netcarvers plugin, should be very useful , to make it even more interesting, you could combine it with
this <a href=“http://forum.textpattern.com/viewtopic.php?id=17545”>hack</a> (courtesy Ace of Dubs).
This would allow you to extend your custom fields to text format, as already mentioned above, and have them easily maintainable,
as extra excerpts fields, below your default excerpt field.
(useful, for extra teaser or welcome blurbs, etc…, or any other text content, that you would like to stay attached to an article)
I found it to work on 4.0.4 development versions as well, however my database broke at times, so I ‘m not able to confirm any side-effects.
(Runs stable now)
(CAUTION.: dump your database for backup, before doing this)
⌃ ⇧ < ⎋ ⌃ ⇧ >
thanks for the feedback.
Ace’s work extends the custom fields to type ‘text’ from varchar(255) — that will allow you to pack a lot of values into a field!
I don’t think this plugin will have messed up anything on your DB as the plugin is read-only in operation.
FYI: I have prepared a local version with a few changes for 4.0.4 (no new features) but I won’t be releasing it yet. In fact, I’ll be offline for a week (perhaps longer) to move house.
I don’t know if it’s been suggested, but would packs within the body be a good idea? I have a project that doesn’t require data in the body because all I need is the food title, and prices for large and small which will be from customfield input. If I could eliminate using custom fields to begin with it might be easier for the end-user?
I only say this because textpatterns customfield function although very usefull, doesn’t have the organization ability or customization that I would like. I could name a few good reason’s for it not being ready for prime time in end-user world, but I know they’ve been brought up before on the forum. (ex: explaining what not to touch and that they have to work around unrelated options and fields when using customfields) Ah well, just brain-storming.
@Steve: What about the availability for 4.0.4?
I love the idea of having a complete dataset in one custom field … just stumbled upon your plugin.
Get all online mentions of Textpattern via OPML subscription: TXP Info Sources: Textpattern RSS feeds as dynamic OPML
sorry, my time is being focused on the MLP Pack for Textpattern right now hence the slow (ok, zero) progress here.
However, if you are willing to test the latest version for me then I can mail you a copy. Just drop me a line via the contact page of my website and I’ll post it off to you as soon as I get your details.