Reusable. updateable templates

Is it possible to use templates in the more traditional sense in Tiddlywiki? By traditional sense I mean when you base something on the template, and then change the template, all the things that were based on that template change as well.

So, for example, if I had a template that colored the background blue. Then created a bunch of tiddlers based on that template. Then went back later and changed the template background to red, could I get all the previously created tiddlers change their background to red? This is an over simplified example of course.

Thanks.

Yes you can, especially if you transclude the template rather than use it to paste into the tiddlers involved.

{{||tamplatetiddler}}

These templates can be introduced to tiddlers not as content in a tiddler text field but via the view template mechanism, or the “view template Body” cascade.

Templates are a very useful mechanism but there are many kinds, I try to keep the content in a tiddler to be only related to that tiddler and nothing but that tiddler. With any templates “layered on top”, not included in the tiddler. Writing TiddlyWiki script and code is different, but content tiddlers are best kept for content only.

  • One trick is to make it so you only need to change something in one place for it to effect all relevant items.

I/we can give you more info, just ask.

Some templates are like a stamp, they make a new copy of the image, many copies;

Other templates are like a window/screen through which you view many similar items. The window/screen effects how and what you see in the thing you are looking at. Lets you view many things the same way.

  • This is the type you want, just change the way the window/screen displays the underlying tiddler.

That was very helpful. Thank you. I was able to set it up just like I wanted (after fixing a recursive transclusion error…oops :slight_smile: ).