ShowWhen

14 views
Skip to first unread message

RA

unread,
Jul 10, 2008, 2:13:38 PM7/10/08
to TiddlyWiki
Is there a way to show a part of a tiddler conditionally? I know about
HideWhenPlugin, but it can only be used in a template. Can I use it in
a regular tiddler or is there some other plugin/script/trick for
conditional visibility?

R.

cmari

unread,
Jul 10, 2008, 3:29:21 PM7/10/08
to TiddlyWiki
The ShowWhenExists macro from the HideWhenPlugin can be used inside a
tiddler.

For example to show part of tiddler2 inside tiddler1:
<<showWhenExists [[tiddler2]]>><<tiddler [[tiddler2/part1]]>>

Or, inside a single tiddler, you could show part2 if part1 exists.
<part part1 hidden></part>
<<showWhenExists ./part1>><<tiddler ./part2>>
<part part2 hidden>This is the conditional part</part>
Off the top of my head I'm not sure where I would use this, but it's
kind of cool, so I'd be curious to hear what you have in mind!
cmari

Simon Baird

unread,
Jul 10, 2008, 7:30:01 PM7/10/08
to Tiddl...@googlegroups.com
On Fri, Jul 11, 2008 at 4:13 AM, RA <namea...@gmail.com> wrote:

HideWhenPlugin, but it can only be used in a template. Can I use it in
a regular tiddler or is there some other plugin/script/trick for
conditional visibility?


Actually it can be used in a tiddler but you have to put a div around it like this just so there is an element to hide:

{{x{<<hideWhen ....>>
this will be hidden conditionally
}}}

{{x{<<hideWhen ....>>this will be hidden conditionally}}}   /% not sure if this version will work, try it %/


the x can be anything, it's just a classname just so the {{className{...}}} wiki formatting works.

Rustem A.

unread,
Jul 11, 2008, 1:04:25 AM7/11/08
to Tiddl...@googlegroups.com
Thank you cmari and Simon.

Simon, it works either way.

cmari, without a div it hides all of the tiddler, i.e.

=======================================================
! You won't see anything, including this text that is above the conditional part
<<showWhenExists ./nonExistent>><<tiddler ./part2>>

<part part2 hidden>This is the conditional part</part>
=======================================================

And here's my tiddler (requires LoadRemotePlugin and TiddlerTweakerPlugin from TiddlyTools):

=======================================================
{{x{<<showWhen version.extensions.tiddlerTweaker==undefined>>
TiddlerTweakerPlugin is not loaded. Click <<tiddler LoadRemotePlugin with:
  [[here]]
  [[Load TiddlerTweakerPlugin from svn.TiddlyWiki.org repository]]
  [[http://svn.tiddlywiki.org/Trunk/contributors/EricShulman/plugins/TiddlerTweakerPlugin.js]]
  [[window.story.refreshTiddler('TiddlerTweaker',null,true)]]
  [[version.extensions.tiddlerTweaker!=undefined]]
>> to load.}}}{{x{<<else>><<tiddlerTweaker>>}}}
=======================================================

R.

RA

unread,
Jul 11, 2008, 1:43:49 AM7/11/08
to TiddlyWiki
> And here's my tiddler (requires LoadRemotePlugin and TiddlerTweakerPlugin from TiddlyTools):

Sorry, my example requires LoadRemotePlugin only. TiddlerTweakerPlugin
is the one I am loading so the requirement is not to have it locally
in my TW document.

wolfgang

unread,
Jul 11, 2008, 2:51:02 AM7/11/08
to TiddlyWiki
Thanks R,

for giving this example tiddler for conditional inclusion of parts of
tiddlers. Very useful for me too.

Regards,

W.
Reply all
Reply to author
Forward
0 new messages