Setting the filter for the list from a variable?

72 views
Skip to first unread message

leeand00

unread,
Sep 19, 2016, 6:51:48 PM9/19/16
to TiddlyWiki
I have the following template:

<$list filter="[tag[Database Analyst - Net Tech - MIS - Help Desk]tag[ms-access]tag[sql]]">
<ul>
<li><$transclude/></li>
</ul>
</$list>


But I want to be able to call the template from else where and specify the filter string from outside (almost like passing a variable to the template)

<$list filter="$meFilterString">
<ul>
<li><$transclude/></li>
</ul>
</$list>

Is there per chance a way to do this?

Mark S.

unread,
Sep 19, 2016, 7:50:11 PM9/19/16
to TiddlyWiki
I would use a macro IF you plan to pass off filters manually. Assuming that you want the macro to work everywhere, you could create a tiddler with the tag $:/tags/Macro and contents like:

\define helpme(filter)
<$list filter="$filter$">
<ul>
<li><$transclude/></li>
</ul>

</
$list>
\end

and then invoke the macro wherever you want like:

<<helpme
"[tag[Database Analyst - Net Tech - MIS - Help Desk]tag[ms-access]tag[sql]]">>

HTH
Mark

Thomas Elmiger

unread,
Sep 20, 2016, 1:00:00 AM9/20/16
to TiddlyWiki
This works for me (in case I remember that right):

<$set myfilter="[[whatever]]">

<$list filter=<<myfilter>>>
<$transclude/>
</$list>

</$set>

Thomas Elmiger

unread,
Sep 20, 2016, 1:02:35 AM9/20/16
to TiddlyWiki
By the way: I put the <ul> outside the list.
Reply all
Reply to author
Forward
0 new messages