What is this example trying to explain

Could someone please enlighten me on what the example at the bottom of the tabs page is trying to explain. It makes no sense to me whatever.

It’s obvious that I can access the currentTab variable but how does this help currentTiddler? When I check on selecting a tab, both currentTab and currentTiddler are set to the same value, namely the title of the tiddler that represents the selected tab.

Is there any way of storing the value of currentTiddler BEFORE actioning the tab by clicking on it? This is the source of my Set tiddler X field Y value Z query from yesterday. I am looking at @Scribs link to the Triggering an action on appear / when rendered - #2 by pmario

bobj

Try this on the TiddlyWiki website to see the difference:

Edit the “Forums” tiddler like so…


! Official Forums

<<currentTiddler>>

When viewing the “Forums” tiddler on its own in the StoryRiver, the text should transclude the title “Forums” underneath the Level1 header.

Now go to the “Community” tiddler and view the Forums tab. It should be transcluding the parent “Community” title instead of the currentTab “Forums” title.

Now go back and edit the “Forums” tiddler to start with…

! Official Forums

<<currentTiddler>>

<$tiddler tiddler=<<currentTab>>>
<<currentTiddler>>
</$tiddler>

Viewing the “Forums” tiddler in the StoryRiver should show the text “Forums” twice.

Go back to the “Community” tiddler and view the “Forums” tab again.

The <<currentTiddler>> that is outside of the <$tiddler> widget should be transcluding the title of the parent “Community” tiddler rather than the “Forums” tab title.

The <<currentTiddler>> inside the <$tiddler> widget should be transcluding the title of the “Forums” tab title.

The code example should have no difference when viewing a tab tiddler on its own, but should make the currentTab variable match the currentTiddler variable when viewed inside the Tabs macro, instead of using the parent tiddler title where the tabs are located.

Here’s my explanation:

If a tiddler can be expected to be viewed both directly in the StoryRiver and as part of a tabset, and that tiddler’s content uses field references such as {{!!title}} or {{!!somefield}}, then placing <$tiddler tiddler=<<currentTab>>> at the start of the tiddler content ensures that those references will be processed the same, regardless of where the tiddler is displayed.

This works because, when the tiddler is viewed directly in the StoryRiver, the value of <<currentTab>> is undefined, so the <$tiddler tiddler=<<currentTab>>> syntax has no effect on the content that follows it.

-e