> I've been doing some experiments on "extended data" abilities. I was
> trying to find some alternatives/complements to tags and I find that:
> *Custom fields are inside core TW
> *So do slices
Slices are embedded as "user-visible" content within the body of a
tiddler (though they CAN be enclosed in /%...%/ comment delimiters),
which makes them portable between standard TW documents, without
needing any customizations.
When working with slices, these may be helpful:
http://www.TiddlyTools.com/#SliceGridPlugin
http://www.TiddlyTools.com/#ShowSlices (script)
Slices are most useful when you want to quickly enter a few "ad hoc"
data values into a tiddler that otherwise contains regular wiki-
formatted content. However, slices are intended simply for defining
name:value pairs and are NOT designed to handle "extended data"
types. That's where custom fields take over...
Defining and using custom fields in your tiddlers is relatively
straighforward:
First, you customize your [[ViewTemplate]] and [[EditTemplate]] to add
the approriate "<<view fieldname wikified>>" and "<<edit fieldname>>"
macros, respectively. This will add a custom field called "fieldname"
to every NEW tiddler as it is created and each EXISTING tiddler when
it is next edited, and will display the value entered in "fieldname"
as wiki-formatted content when viewing all tiddlers.
Of course, exactly how and where to put those macros in the templates
is determined by your specific use-case. Also, if you want different
custom fields to be applied to different sets of tiddlers, then you
*don't* want to modify the common ViewTemplate/EditTemplate
definitions.
Instead, you can use
http://www.TiddlyTools.com/#TaggedTemplateTweak
to create alternative templates that use a tag value as a prefix
(e.g., "MyTagViewTemplate" and "MyTagEditTemplate"). Simply tag a
tiddler with that prefix ("MyTag"), and it will use the alternative
view/edit templates automatically. For some examples of custom view/
edit templates using TaggedTemplateTweak, check out:
http://www.TiddlyTools.com/#CDSample
http://www.TiddlyTools.com/#CDViewTemplate
http://www.TiddlyTools.com/#CDEditTemplate
and
http://www.TiddlyTools.com/#[[MediaSample - QuickTime]]
http://www.TiddlyTools.com/#[[MediaSample - Windows]]
http://www.TiddlyTools.com/#MediaViewTemplate
http://www.TiddlyTools.com/#MediaEditTemplate