On Saturday, March 21, 2015 at 5:55:16 AM UTC-7, Mikey Kusnetsov wrote: > > I am trying to write a tiddler template that "assembles" itself from > little parts. In particular, I will have a number of tiddlers, each with a > number of fields, and then a "View" tiddler that will present the target > tiddler in different ways, depending on what fields it has. The broad > structure of the output will be: > > *Header > *Text > *FooterA/FooterB/FooterC > > Where the content of the header will vary depending on the fields of the > target tiddler, and the choice and content of the footer will also depend > on the fields. > > So I would like there to be a way of saying something like "Display this > chunk of text if the target tiddler is tagged in a certain way or has a > certain field, but otherwise do nothing at all". I've tried different > approaches, none of which have worked so far. > > You can use the <$list> widget with a filter that begins with [all[current]], which limits the filter to the current tiddler. The rest of the filter can then test for various tags and fields. Here's a few examples:
<$list filter="[all[current]tag[sometag]]"> <!-- if tagged with "sometag" --> content to display if tagged <$list> <$list filter="[all[current]has[fieldname]]"> <!-- if the field exists --> content to display if tagged <$list> <$list filter="[all[current]fieldname[fieldvalue]]"> <!-- if the field has a specific value --> content to display if tagged <$list> There are many more filter operators available. See http://tiddlywiki.com/#Filters for more details. enjoy, -e Eric Shulman TiddlyTools / ELS Design Studios "Inside TiddlyWiki: The Missing Manual" https://www.indiegogo.com/projects/inside-tiddlywiki-the-missing-manual/x/8816263 Note: the IndieGogo funding campaign has ended, but direct fundraising continues below... YOUR DONATIONS ARE VERY IMPORTANT! HELP ME TO HELP YOU - MAKE A CONTRIBUTION TO MY "TIP JAR"... http://TiddlyTools.github.com/fundraising.html#MakeADonation Professional TiddlyWiki Consulting Services... Analysis, Design, and Custom Solutions: http://www.TiddlyTools.com/#Contact -- You received this message because you are subscribed to the Google Groups "TiddlyWiki" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/tiddlywiki. For more options, visit https://groups.google.com/d/optout.

