Tinderbox 7 Icon

HTML Export: ^value^ vs. ^get^

Since v4 guidance is to shift to export attribute values using ^value($Attribute)^ rather than ^get(Attribute)^ and ^value($Attribute(Some note))^ rather than ^getFor(Some note, Attribute)^. ^get^ and ^getFor^ are now deprecated.

Do be aware that to get the expected value in the exported data some attribute data types, especially Date and Color require the attribute value to be enclosed in a format() call:

^value($Color2)^: dark warm gray dark

^value(format($Color2))^: #403a35

^value($Created,"*")^: 2010-01-07T10:46:17+01:00

^value(format($Created,"*"))^: Thu, 7 Jan 2010 10:46:17 +0100

An added advantage of the ^value^ method is that the exported value is an evaluated expression so it is possible to manipulate attribute data. If $MyNumber is 5:

^value($MyNumber)^: 5

^value($MyNumber*3)^: 15

Note that the evaluated result is only seen in the exported code; the source attribute(s) are not affected.

Compared to old methods like ^text^ and ^title^, ^value^ does not evaluate any inline ^ export code in $Text or $Name - for instance macros, linkTo and include codes. In such context, trying ^value(eval($Text))^ does not help as eval() evaluates action code rather than export code.

Referencing a template's attributes. Unlike all other notes, in an export template (i.e. $IsTemplate is true), referencing an attribute refers to the note being processed and not the template. To refer to the template is its path or name, thus $AttrName(template-name) not $AttrName.



A Tinderbox Reference File : Export : HTML Export: ^value^ vs. ^get^