The {{thing}} *is* the transclusion.
But it sounds like you want to change the color of a tiddler based on some
criteria. If your criteria is a tag, for instance, than the easy way to do
this is with a stylesheet.
For instance, say you have tiddlers tagged "Yellow".
Then make a tiddler and tag it $:/tags/Stylesheet and put this content in
it:
[data-tags*="Yellow"].tc-tiddler-frame {
background-color: yellow ;
}
Save the tiddler.
Now all your tiddlers tagged "Yellow" will have a yellow frame. This is the
entire frame, and not just the body which is just the text part. The actual
body is identified as .tc-tiddler-body
In general, real templates are used to *add* display functionality to
tiddlers. They don't *change* the existing way the text is presented. There
are many things that can be accomplished just with stylesheets and CSS.
HTH
On Tuesday, September 14, 2021 at 8:45:02 AM UTC-7 [email protected] wrote:
> Sorry I can't get what your meaning, I copied your code to my tw, nothing
> happened,
> what I want is a template which can change the background color of the
> Transclusion.
>
> I check the link
> https://tiddlywiki.com/static/Transclusion%2520with%2520Templates.html
>
> which give a example
> ```
> @@background-color:yellow;
> {{!!title}}
> @@
> ```
>
> {!!title} will show the title literaly. But I need the body of the tiddler
> not title how to set it?
>
> I don't know the meaning of this code. It seems not like a template
>
> \define test()
> This is a test
> \end
>
> <<test>>
>
> <pre><code><$view ></code><pre>
>
>
>
> On Tuesday, September 14, 2021 at 7:39:06 PM UTC+8 PMario wrote:
>
>> Hi
>>
>> Try something like this:
>>
>> \define test()
>> This is a test
>> \end
>>
>> <<test>>
>>
>> <pre><code><$view ></code><pre>
>>
>>
>> On Tuesday, September 14, 2021 at 11:14:04 AM UTC+2 [email protected]
>> wrote:
>>
>>> I read the page
>>> https://tiddlywiki.com/static/Transclusion%2520with%2520Templates.html
>>>
>>> which tell me how to make the template of the Transclusion Which I think
>>> is great.
>>>
>>> But I don't know how to make the template to show it's own info.
>>>
>>> If I use the "{{}}" in the template tiddler I will get a recursive
>>> error.
>>>
>>> {{!!title}} works fine but I rarely use it.
>>>
>>> This will get a recursive error.
>>> ```
>>> @@background-color:yellow;
>>> {{}}
>>> @@
>>> ```
>>>
>>
--
You received this message because you are subscribed to the Google Groups
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/tiddlywiki/c173519a-ab99-4136-ae09-5feb3c281af7n%40googlegroups.com.