Hi Skye,

Are you trying to show a photo in a particular tiddler?
I have never heard of the 'showWhen' macro but there is another way to
show a different img, depending on the protocol type, in a given
tiddler.

Firstly create a tiddler to contain the imgs. Give it 2 sections (one
for local, one for external), like this;

!External
[img[title text|http://path/to/image.jpg]]

!Local
[img[title text|file:///C:/path/to/image.jpg]]

We can now use this in other tiddlers through transclusion (more info
here http://tiddlywiki.org/wiki/Transclusion)
Then in the tiddler where we want either the locally or externally
hosted image to display we can use the <<tiddler>> macro and do this:

<<tiddler {{ if(window.location.protocol == "file:"){
 "ImagesTiddler##Local" } else {
"ImagesTiddler##External"
}
}}>>

So this performs the check on the protocol and matches it against
"file:" If it is it outputs "ImagesTiddler##Local", which selects just
the !Local slice of the ImagesTiddler tiddler.
This is equivalent to just writing <<tiddler imagesTiddler##Local>>.
If it does not match "file:" it will output the slice required to
display the !External slice.

I hope that solves your problem.

Colm

p.s you could write the snippet above as:
<<tiddler {{ (window.location.protocol == "file:") ?
"ImagesTiddler##Local":"ImagesTiddler##External" }} >>
if you want it to look a bit neater.

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To post to this group, send email to tiddlyw...@googlegroups.com.
To unsubscribe from this group, send email to 
tiddlywiki+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/tiddlywiki?hl=en.

Reply via email to