"tabs" Macro : Tiddlers that depend on <<currentTiddler>>

64 views
Skip to first unread message

Mohamed Amin

unread,
Nov 6, 2020, 1:21:42 AM11/6/20
to TiddlyWiki
Hello All,

Suppose that I've the following 3 Tiddlers:
  1. "Parent"
  2. "Child01" : with a filed "my-parent" = "Parent"
  3. "Child02" : with a filed "my-parent" = "Parent"
And : 
  • I use "tab" Macro in the first Tiddler ("Parent" tiddler) to list the other 2 "Child" Tiddler.
  • Both "Child01" and "Child02" are using <<currentTiddler>> variable internally

Now, as per the last part of "tabs Macro" Documentation , the <<currentTiddler>> will not affected by "tab macro" which is understandable.

My problem now is that I didn't understand how to overcome this using the "TemplateTiddler" (example in the above link )

so, I appreciate some help with more clear/detailed example.

Best Regards

Eric Shulman

unread,
Nov 6, 2020, 3:27:21 AM11/6/20
to TiddlyWiki
On Thursday, November 5, 2020 at 10:21:42 PM UTC-8, Mohamed Amin wrote:
as per the last part of "tabs Macro" Documentation , the <<currentTiddler>> will not affected by "tab macro" which is understandable.
My problem now is that I didn't understand how to overcome this using the "TemplateTiddler" (example in the above link )

There are two ways to do this:

Method #1:
In each of the "ChildNN" tiddlers, add this line at the beginning:
<$tiddler tiddler=<<currentTab>>>

Method #2:
Create a separate tiddler (e.g., "TabsTemplate") containing
<$tiddler tiddler=<<currentTab>>>
<$transclude mode="block" />
</$tiddler>
then, in your tabs macro, write:
<$macrocall name="tabs" tabsList="Child01 Child02" template="TabsTemplate" />

In either method, the $tiddler widget sets the currentTiddler value within the ChildNN tiddler to be the currentTab name (e.g., "Child01" or "Child02").  Note that if you view a ChildNN tiddler separately (i.e., outside of the tabset), then the currentTab value is undefined, and the $tiddler widget does nothing, which is OK, since the currentTiddler value will already correctly refer to the tiddler you are viewing.

-e
Message has been deleted
Message has been deleted

Mohamed Amin

unread,
Nov 6, 2020, 5:38:45 AM11/6/20
to TiddlyWiki
Thanks a lot Eric, everything is crystal clear now.

Appreciate your support
Reply all
Reply to author
Forward
0 new messages