What I mean is, to set up your ViewTemplate, e.g.

<div macro='tiddler GetThumb'></div>

...wherever you want the image.

Then some GetThumb would identify what tiddler we are in...

var tid = story.findContainingTiddler( place );
tid = tid ? tid.getAttribute( 'tiddler' ) : '';

...and see if it either had a field or hidden slice called *image-thumb* or 
*image-full *and render it at the appropriate place, if it is set. That 
content actually could be more than just an image.

Here's how the script would read it from a slice:
var img = store.getTiddlerText(tid + '::myImgSlice');

or getting from a field...
var img = store.getValue( tid ,'fieldname');

...eventually doing something like...
if(img) wikify( img , place);

The entire script should look somewhat like this...

*[[GetThumb]]*
var tid = story.findContainingTiddler( place );
tid = tid ? tid.getAttribute( 'tiddler' ) : '';
var img = store.getTiddlerText(tid + '##THUMB');
if(img) wikify( img , place);

If you call *GetThumb* from your ViewTemplate or a conditional ViewTemplate 
(TaggedTemplateTweak) it should render the contents whenever a tiddler had 
a hidden *thumb* section:

/%
!THUMB
*[img[path/to/my/thumb.jpg]]*
!END%/
*
*
Cheers, Tobias.


Am Samstag, 16. Februar 2013 00:30:38 UTC+1 schrieb Mat:
>
> Thanks for your reply Tobias! Yes, something like blog posts could benefit 
> from this. Often fixed layouts. But are you saying it should be limited to 
> merely *one *iconic image recurring on different tiddlers? I'm thinking 
> more of something to easily include tiddler specific images.
>
> From my perspective, (hidden) slices or fields are a better and more 
>> flexible way though... otherwise you have to keep to many things in mind, 
>> e.g. using a slice or field you can easily rename the tiddler while keeping 
>> the linked image working.
>
>
> Please elaborate. I don't know if I understand you right, but are you 
> saying it would be better to use slice or field values instead of the 
> tiddler title? Sounds very interesting - but how is the value set by 
> default, ie to achieve the desired automatic display of the image?
>
> <:-)
>

-- 
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 post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/tiddlywiki?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to