> However, I would like to make a list of al tiddlers with a certain tag and
> their expiry date. For now I used foreachtiddlerplugin to generate a list
> of the tiddlers and their modified date, which is a substitute for their
> expiry date. Yet, I prefer to use an expiry date and would like to attach
> this to the tiddler using the datatiddlerplugin.
You can add custom fields to tiddlers without using any plugins at
all.
First, you need a way to enter the field....
To do this, you modify the [[EditTemplate]] to define a text input for
your custom field:
<div class='editor' macro='edit expirationdate'></div>
You can place the input field anywhere you like in the template. In
this case, I put it following the normal multi-line text input, like
this:
-----------------------
<!--{{{-->
<div class='toolbar' macro='toolbar
[[ToolbarCommands::EditToolbar]]'></div>
<div class='title' macro='view title'></div>
<div class='editor' macro='edit title'></div>
<div macro='annotations'></div>
<div class='editor' macro='edit text'></div>
<div class='editor' macro='edit expirationdate'></div>
<div class='editor' macro='edit tags'></div><div
class='editorFooter'><span macro='message views.editor.tagPrompt'></
span><span macro='tagChooser excludeLists'></span></div>
<!--}}}-->
-----------------------
Note: custom field names must be ALL LOWER CASE for the TWCore to
properly access them.
NEXT... you will probably want to be able to view the expiration date
when you *display* the tiddler. To do this, modify the
[[ViewTemplate]] by adding this line:
<div macro='view expirationdate'></div>
As with the EditTemplate change, you can place the field display
anywhere you like in the template. In this case, I put it in the
subtitle, following the normal modified/created date displays, and
included a bit of text surrounding it, like this:
(expires on: <span macro='view expirationdate'></span>)
----------------------
<!--{{{-->
<div class='toolbar' role='navigation' macro='toolbar
[[ToolbarCommands::ViewToolbar]]'></div>
<div class='title' macro='view title'></div>
<div class='subtitle'><span macro='view modifier link'></span>, <span
macro='view modified date'></span> (<span macro='message
views.wikified.createdPrompt'></span> <span macro='view created
date'></span>)
(expires on: <span macro='view expirationdate'></span>)
</div>
<div class='tagging' macro='tagging'></div>
<div class='tagged' macro='tags'></div>
<div class='viewer' macro='view text wikified'></div>
<div class='tagClear'></div>
<!--}}}-->
----------------------
Finally, and most important for your use-case... you will want to
access this field from within the <<forEachTiddler>> macro that you
are invoking. Within the fET context, you can reference the custom
fields of the current tiddler object by writing something like:
tiddler.fields['expirationdate']
enjoy,
-e
Eric Shulman
TiddlyTools / ELS Design Studios
HELP ME TO HELP YOU - MAKE A CONTRIBUTION TO MY "TIP JAR"...
http://www.TiddlyTools.com/#Donations
Professional TiddlyWiki Consulting Services...
Analysis, Design, and Custom Solutions:
http://www.TiddlyTools.com/#Contact