Tinderbox Forum

Reference an attribute within an include template

Is there a way to reference an attribute from template (t1) and use it in another templated (t2)?

For further explanation, here is my use case:

The content of a note is exported as html by using template t1.

An agent which shows all notes in an ordered list uses template t2. The content of the agent with template t2 is included in template t1.

Inside Template t1

This works fine.

But …

To emphasise in template t2 which note is shown in t1 I want to reference an attribute from t1 in t2.

Pseudocode, something like
Inside Template t2
if(MyAttrib(t1)==MyAttrib) make text bold …

I tried this, that, original … but nothing worked. To put a long question short: How does the include template t2 know it is included by templated t2?

Thanks for your advice.

This solution works for me

Inside t1


Inside t2

^if($MyAttrib(parent)==$Dramatica)^ … endif

If your template includes the note /t2, then this will be bound to /t2.

Often (as, I think, here) you want to refer to attributes of the page being exported, rather than those of the included note. The designator current does this.

1 Like

A few more notes for later readers on the designators ‘current’, ‘this’ and ‘that’. Latter is tangential to the immediate context but another source of relative reference confusion.