Create and Use of Virtual Tiddlers

Definition

  • A virtual tiddler is not a physical tiddler.
  • It does not exist as real data in the TiddlyWiki file saved on disk.
  • It will not appear in search results or be listed in indexes.
  • However, it can be displayed in the Story River when triggered, giving the appearance of a normal tiddler.

Virtual tiddlers are dynamically generated views that do not exist as stored content in the wiki. They are temporary and only rendered when requested, often used to display dynamic or computed information.

These virtual tiddlers are typically shown in the Story River, where they behave like regular tiddlers — with titles, content, and even custom controls — but without being permanently saved in the wiki’s database.

Quick Guide

This is a quick guide to creating virtual tiddlers in TiddlyWiki using a custom solution called ā€˜ā€˜simple’’.

Overview

The ā€˜ā€˜simple’’ solution allows you to create virtual tiddlers dynamically. These are not real tiddlers stored in the wiki, but rather temporary views generated on demand.

Key Features

  • A virtual tiddler is created using a button
  • The title of each virtual tiddler begins with the prefix: $:/virtual/

Components of a Simple Virtual Tiddler

The ā€˜ā€˜simple’’ virtual tiddler uses several tools to function effectively:

Button Creation Procedure

  • Generates a button that, when clicked, opens the virtual tiddler in the story river

Cascade View Title Template Filter

  • Controls how the title of the virtual tiddler is displayed
  • Uses the filter defined in: [[simple/ViewTemplateTitleFilters]]
  • The actual title template used by the filter is located in: [[simple/Template/TitleTiddler]]

Cascade View Body Template Filter

  • Controls how the body content of the virtual tiddler is displayed
  • Uses the filter defined in: [[simple/ViewTemplateBodyFilters]]
  • The body template used by the filter is given in: [[simple/Template/BodyTiddler]]

Custom Stylesheet

  • Applies styling specifically to the simple virtual tiddler
  • Hides all buttons except the ā€˜ā€˜Close’’ button for a clean and relevant interface

Here is the Simple Virtual Tiddler bundle, creates virtual tiddlers and display them in story river. To give a give a try, download and drag and drop into https://tiddlywiki.com and open the simple/demo

1 Like

I invite all interested members to contribute to improving the above wiki. Please expand the concept by real use cases.

1 Like

I’m afraid this seems to contradict what I think of as virtual tiddlers.

Here are three examples of what I think of as Virtual Tiddlers:

  • JSON Operators. This tiddler does not exist. Nonetheless, a template is applied to show which tiddlers have the tag JSON Operators.

  • Martha C. Nussbaum. This tiddler does not exist. Nonetheless, a template is applied to show works likely written or edited by Ms. Nussbaum.

  • Card 8675309. This tiddler does not exist. Nonetheless, a template is applied to show a specific Bingo card based on that id.

What they have in common is that there is no actual tiddler. In one way or another, the title is used to determine how to apply a template. In the first example, the ViewTemplate content is guarded with <%if [<storyTiddler>!has[text]!has[tags]tagging[]] %>. In the second, the ViewTemplateBodyFilter is triggered by [is[missing]!is[system]then[$:/springer/ViewTemplate/author]]. In the third, the ViewTemplateBodyFilter is triggered by [prefix[Card_]then[$:/_/bb/templates/bingo-card]] and if we match, that template removes the Card_ prefix to yield a card variable used in creating the bingo card.

To me, that is what virtual tiddlers are all about.

1 Like

I don’t see any contradiction here. None of them exist as actual stored tiddlers — they are all generated or computed at runtime. The difference may simply come down to the mechanism being used.

Since the original post is a wiki post, feel free to edit and improve it as you see fit.

I haven’t yet because I felt like our views were too radically different. It seemed to me that you were talking about something only vaguely related to my idea of a virtual tiddler. It seemed better to come to a consensus before starting an edit war.

However…

Interesting, because I still see your description very much at odds with my expectations.

Ok, that does match my conception of virtual tiddlers.

I would not expect there to be any general-purpose mechanism for their usage. They would vary substantially from wiki-to-wiki.

It feels as though you’re trying to explain the concept of virtual tiddlers by way of your—admittedly interesting—but far from universal ā€œsimpleā€ system.

I read the following as if it was intended to be a general description of virtual tiddlers:

Key Features

  • A virtual tiddler is created using a button
  • The title of each virtual tiddler begins with the prefix: $:/virtual/

And if you only mean this to be a description of ā€œsimpleā€, then I think there only some minor cleanup of the text necessary, just to make that clear.

If, though, it is meant to be more generic, then I’m going to disagree strongly. A virtual tiddler is not necessarily created using a button. If fact I’ve never created them that way. Nor have I ever created one with the prefix $:/virtual.

To my mind, virtual tiddlers are placeholders for something I may want to create. On one recent project, I was collecting into a wiki scattered links to documentation about a large system at my day job. The form for entering one of them included an authors field, which I fill in with comma-separated list of names that get turned into a title list when the form is submitted. If I fill it in with a list like ā€œMohammad Rahmani, Scott Sauyet, Elise Springerā€, when I view the saved tiddler, my template includes a list of authors:

* [[Mohammad Rahmani|Author/Mohammad Rahmani]]
* [[Scott Sauyet|Author/Scott Sauyet]]
* [[Elist Springer|Author/Elise Springer]]

And if I have already created Author pages for Mohammad and Elise, then you just visit them normally. But if I haven’t yet created one for Scott, you can still visit it. There is a notice that this tiddler hasn’t been created, and so there’s no biographical info on it. But there is a list of documents Scott has authored because I have a template for that which shows on any tiddler titled like Author/Full Name. And I have a sidebar/more tab similar to the ā€œMissingā€ tab, which shows those authors linked to but not created.

To me that’s what virtual tiddlers are for. I would expect that in @Springer’s bibliography page, on importing a bibtex entry, she automatically adds links to the authors. If they don’t already exist yet, a template shows the works authored/edited. Tiddlywiki.com does this for non-existing Tag Tiddlers. My bingo page does something similar for card numbers.

The commonalities are that they derive information from the title of a nonexistent tiddler in order to apply certain templates to view it.

If your post is meant to capture all of these sorts of virtual tiddlers, then I think it falls far short. If you mean only to document the ā€œsimpleā€ system, I think we probably only need a bit more clarification.

But I would also be curious to learn how you use these ā€œsimpleā€ virtual tiddlers. I’m having a hard time imagining places where I would use them.

2 Likes

Don’t we already have an established concept for this? https://tiddlywiki.com/#Temporary%20Tiddlers

What is the difference betweehn temporary tiddlers and virtual tiddlers?

A temporary tiddler exists as a tiddler in memory, even if though it’s not stored.

A virtual tiddler does not even exist in memory. There is no JSON Operators tiddler. But if you ask the wiki to open it anyway, it shows you some useful information that can be gleaned just from the title.

1 Like

This is merely related to the approach I used. The reason, I used such title prefix, is to simply recognize them, for example in the open tab. Other reason is this approach allows to handle different scenarios just like TW does. The approach I described can be used for creating helper tools, like a temporary dynamic UI for making a print profile, or dynamic statistics, …

So consider it as one example. I see you have another approach, and it is really useful.

What we need to agree is the definition of virtual toddler and I see we are very close, but the use cases and implementation approaches are different and this is useful.

This discussion is confusing me.

Is a VT (Virtual Tiddler) –

1 — any transient programmaticly spawned Tiddler;

2 — any Tiddler that is Un-saveable;

3 — a ghost.

AFAICT a virtual tiddler is a missing tiddler, to which a ViewTemplate is applied in order to make it behave like it would exist.

Here is an example I use in some TWs for tag tiddlers, virtual or not.

The cascade filter tiddler, tagged $:/tags/ViewTemplateBodyFilter:

[<currentTiddler>is[draft]then{!!draft.of}else<currentTiddler>tagging[]then[$:/tw-FRed/template/viewtemplate-tag]]

And the (simplified) ViewTemplate itself:

\define btnCreateActions()
<$action-createtiddler
  $basetitle=<<unusedtitle baseName:"$(titre)$" separator:"_">>
  $template={{!!@instance.template}}
  tags={{{[<titre>format:titlelist[]]}}}
>
<$action-sendmessage
  $message="tm-edit-tiddler"
  $param=<<createTiddler-title>>
/>
</$action-createtiddler>
\end


<$let titre={{{ [<currentTiddler>is[draft]then{!!draft.title}else<currentTiddler>] }}}>

!! Tiddlers tagged ''<<titre>>'':

<ul><$list filter="[<titre>tagging[]]"><li><$link/></li></$list></ul>
</$list>

<$button actions=<<btnCreateActions>> class="tc-btn-boxed">
{{$:/core/images/new-button}} Nouveau tiddler Ā« <<titre>> Ā»</$button>
</$let>

<$list filter="[<currentTiddler>!text[]]" variable=none>

---
<$transclude mode=block/>
</$list>

The filter first gets the real tiddler title, even in edit mode, then tests if it’s used to tag other tiddlers, then returns the ViewTemplate title.

The ViewTemplate displays a list of tagged tiddlers, a button to create a new tiddler (similar to ā€œNew hereā€ view mode button) and, when the tag tiddler actually exists, displays its text field.

I find this useful with TOC sidebar tab: I can click any topic in the TOC and get a tiddler allowing me to add an item there, whether the tag tiddler is missing or not.

Fred

2 Likes

That sounds exactly right to me.

2 Likes

I see your description here as covering what your package does and how, but I’m not yet understanding why (what problem this kind of $:/virtual tiddler helps us solve).

For all the use-cases I’ve worked on over the years, the value of a virtual tiddler IS its name. It’s an author name, or a tag name, or a field name, or a field-value name, etc… It’s not ā€œcreatedā€ (by a button or otherwise), but it gets displayed in the story river because a tag-name link is clicked, or an creator-name, or some other field is designed to offers its contents as links, even though not all of them point to tiddlers.

It’s a ā€œnodeā€ in tiddler-naming-space, and it’s valuable to show a template for that ā€œvirtualā€ tiddler (for that node) because the template can pull together some useful information for that meaningful node in tiddler name-space, even though there’s no such tiddler (yet). AND, since the node is already a meaningfully-titled node, it’s easy to invoke edit mode to add further details for this tiddler… Saving those changes makes it now real, and one wants it to be real as the helpfully-named tiddler with no special prefix. (Often, the template that showed for the missing tiddler is a kind of view template that will continue to apply to the real tiddler (as a helpful footer or dynamic table, etc.). But occasionally one may want some template to appear only so long as the node is empty ( = tiddler is virtual).)

Like @Scott_Sauyet I suspect that your solution here, @Mohammad, is using the concept of ā€œvirtual tiddlersā€ a bit differently (since I’m still baffled by the $:/virtual prefix — what purpose it serves).

So perhaps an example of how you’d use this $:/virtual approach (with examples that show what kind of problem it solves) would help us appreciate another dimension to what ā€œvirtualā€ could mean.

3 Likes