{{tid!!field}} of course transcludes the tiddlers field.
…but when wanting to apply a template, it seems this does not work:
{{tid!!field||template}}
It appears !!field is ignored. Inside the template, it seems currentTiddler refers to the current tiddler, which perhaps should be expected, but there is no currentField… so it seems I must again transclude the field if I want it’s value in the template - {{!!field}}
Must use of templates in transclusion omit the full textreference? Or is there a way to directly access the “current” fieldvalue in the template?
Hi @twMat TiddlyWiki should not really allow constructions like {{tid!!field||template}} because it is meaningless. The two parts are treated as follows:
The first part is the value to be assigned to the “currentTiddler” variable. Here we’ve got a tiddler title and a field name, but the “currentTiddler” variable cannot reference a field, it can only reference a tiddler
The second part is the title of the tiddler to be transcluded. TiddlyWiki doesn’t allow a full text reference, just a tiddler title
In retrospect, I think there’s a bug in TiddlyWiki’s design here. In templated transclusions it should allow {{title||template!!field}} but not {{title!!field||template}}.
I think this is actually doing something slightly different; it is getting the value of the field “field” of the tiddler “tid”, and then using that as the title of the tiddler to transclude. In other words there is an extra level of indirection that is not supported by the transclusion shortcut syntax.
What do you suggest to do? The thing is, I’m making a template that I want other users to easily be able to modify. But I don’t want them to have to bother with the complex title of the tiddler holding the field. Ideally they should just have “a variable” that directly points to the field. Something like “currentField” or the name of the field itself.
At (1) the user enters various labels and headings, that show up at (2). The user might want to style these, so there are direct links at (3) to their templates.
The labels/headings are, along with other settings, stored in fields in a tiddler titled $:/plugins/TWaddle/static/settings in fields named page-head, tags-head etc, along with other settinfields in that tiddler.
I wish that the user is not exposed to, nor need to type, the title of that settings tiddler but the field names are friendly.
Hi @twMat I understand that you want to avoid the user seeing links to $:/plugins/TWaddle/static/settings, but I don’t see any such links, nor how they would arise.
I am using the {{{ [{tid!!field}]||template }}} construct. I am still wondering about a better method to get “currentTiddler” inside the template to refer to the fieldvalue (as this successfully does).
My confusion was that I got “currentTiddler” mixed up to mean, well, the tiddler, meaning that the user would need to do work with this to extract the field contents.