> in ViewTemplate. The tricky bit is how to refer to the tiddler which so
> transcludes the script, within the script (if you need that). Given the use
> of InlineJavascriptPlugin it can be done with something like
>
> var transcludingTiddler = place.parentNode.parentNode;
> var transcludingTiddlerTitle = transcludingTiddler.id.slice(7);
> var transcludingTiddlerHash = store.getTiddler(
> transcludingTiddlerTitle).fields._hash;
>
> to talk about the transcluding tiddler. Beware: MyScript by itself
> (untranscluded!) will output "TypeError:
> store.getTiddler(transcludingTiddlerTitle) is null". Not a problem by
> itself, but this will appear in e.g. not-yet-existing tiddlers. So you may
> want to wrap the MyScript div in a Show/HideWhen macro div.
>
> Seems to work well. Maybe there are less macgyvery solutions though?
Try these TWCore functions:
get the rendered DOM element for the current tiddler, regardless of
how deeply transcluded:
var here=story.findContainingTiddler(place);
get the current tiddler's title from the DOM element:
var title=here.getAttribute('tiddler');
get a custom field value, given a title and field name:
var val=store.getValue(title,'_hash');
enjoy,
-e
Eric Shulman
TiddlyTools / ELS Design Studios
----------
Was this answer useful? If so, please help support TiddlyTools:
TiddlyTools direct contributions: (paypal)
http://www.TiddlyTools.com/#Donate
UnaMesa tax-deductible contributions:
http://about.unamesa.org/Participate (paypal)
TiddlyWiki consulting:
http://www.TiddlyTools.com/#ELSDesignStudios
http://www.TiddlyTools.com/#Contact
--
You received this message because you are subscribed to the Google Groups
"TiddlyWiki" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/tiddlywiki?hl=en.