Show parent-, grandparent-, grandgrandparenttiddler via template

132 views
Skip to first unread message

Magnus

unread,
Nov 17, 2018, 12:33:25 AM11/17/18
to TiddlyWiki
I would like to be able to show the "parent" and "grandparent" tiddler from TOC in my tiddler. I use a toc based on a parent-field, don't remember from where, but how can write a template where I reference a field in the parent-tiddler?

TonyM

unread,
Nov 17, 2018, 6:40:16 PM11/17/18
to TiddlyWiki
Magnus,

Marios tocp plugin will help you do this. So will bimlas's new kin operator (5.1.8 prerelease)

However you can do it manualy using the get[fieldname] in a list to get the parents tiddlername name and reference its fields.

Do you want more info?

Tony

Magnus

unread,
Nov 17, 2018, 11:17:34 PM11/17/18
to TiddlyWiki
Yes, please elaborate on the get operator. How can I use it to get the parent field? I think it is the Marios tocp plugin I use, sounds familiar.

TonyM

unread,
Nov 18, 2018, 6:06:42 PM11/18/18
to TiddlyWiki
Magnus,

The following will get the value of the parent field in the current tiddler and then inside the List widget the parent will become the current tiddler

<$list filter="[all[current]get[parent]]">

</$list>

and this will list the parent

Simply embedding the same again inside will get the parent of the parent (Grand Parent)

<$list filter="[all[current]get[parent]]">
<$list filter="[all[current]get[parent]]">

</$list>
</$list>

Note the blank line in an empty list widget returns the value

So the grate grand parent is found as
<$list filter="[all[current]get[parent]]">
<$list filter="[all[current]get[parent]]">
<$list filter="[all[current]get[parent]]">

</$list>
</$list>
</$list>

However with the use of the variable we can make it more readable, but rather than make use of the currentTiddler, we need to state it in the filter

<$list filter="[all[current]get[parent]]" variable=parent>
<$list filter="[
<parent>get[parent]]" variable=grand-parent>
<$list filter="[
<grand-parent>get[parent]]" variable=great-grand-parent>

</$list>
</$list>
</$list>

But now we can make use of the ability to name the values

<$list filter="[all[current]get[parent]]" variable=parent>
<$list filter="[
<parent>get[parent]]" variable=grand-parent>
<$list filter="[
<grand-parent>get[parent]]" variable=great-grand-parent>
The current Tiddler is <
<currentTiddler>>, its parent is <<parent>>, its grand-parent is <<grand-parent>> its great-grand-parent is <<great-grand-parent>><br>
</$list>
</$list>
</$list>

Let me know if you can find your way from here, their are so many different routes you could take?

Regards
Tony

Magnus

unread,
Nov 20, 2018, 2:28:01 PM11/20/18
to TiddlyWiki
Thank you! That worked perfectly! :)
Reply all
Reply to author
Forward
0 new messages