When I first started with TW I needed a way to ‘turn pages’ going from one tiddler to the next. Someone on this list, I forget who, gave me a tiddler, PageTurner, which did that beautifully, code below.
<$list filter="[<currentTiddler>tag[Artworks]]">
<div style="float:right;">
<$vars prev={{{ [tag[Artworks]sort[]before<currentTiddler>] }}}>
<$vars next={{{ [tag[Artworks]sort[]after<currentTiddler>] }}}>
<$reveal default=<<prev>> type="nomatch" text="">
<$button tooltip=<<prev>>> {{$:/core/images/chevron-left}}
<$action-sendmessage $message="tm-close-tiddler" param=<<currentTiddler>> />
<$action-navigate $to=<<prev>>/>
</$button>
</$reveal>
<$reveal default=<<next>> type="nomatch" text="">
<$button tooltip=<<next>>> {{$:/core/images/chevron-right}}
<$action-sendmessage $message="tm-close-tiddler" param=<<currentTiddler>> />
<$action-navigate $to=<<next>>/>
</$button>
</$reveal>
</$vars>
</$vars>
</div>
</$list>
I now want to do something similar yet different. The problem is that the code works perfectly if I restrict the filters to all artworks.
But my requirement is for a subset of Artworks, for example, all artworks of a type or within a specific date range. I guess I could provide a number of PageTurner tiddlers, each handling a specific filter but I prefer generic solutions. I sort of need to provide my filter as a parameter to this code but can not see a way to do that. I would love it if I could store required filters on separate tiddlers and then use the contents of a tiddler to provide the filter statement to be interpreted at run time.
For example, have a tiddler PG1 with text of [<currentTiddler>object_type[Artist Books]]
and have the filter code in PageTurner read something liked <$list filter=<<PG1>>
Each artwork tiddler has a field object_type
which specifies the type of work that it is, so, Painting, Artist Book, Print, etc.
Can anyone shed some light on this for me?
bobj