Some comnents This technique can save a lot of time. I've added similar divs to my viewtemplate, each different elements in a tiddler. The complexity of working with them is much reduced
my questions, help and navigation are all now automatically written to the tiddler. It makes editing easier. Thanks again. Alex 2009/9/21 Alex Hough <[email protected]> > Hi Eric, > > Thanks at lot it works (not surprisingly) > > There is a small typo: a confusion between double quotes - " - and single > quotes - ' > > The second '' on Erics is not a " (double quote) > > > <div macro='tiddler {{tiddler.title+" Nav"}}'></div> > > They looks similar don't they > <div macro='tiddler {{tiddler.title+" Nav''}}'></div> - wrong 2 X ' > <div macro='tiddler {{tiddler.title+" Nav"}}'></div> - right 1x " > > Note: how difficult is is to type about quotes? > > Thanks again! > > ALex > > 2009/9/21 Eric Shulman <[email protected]> > > >> > <div content = 'tiddler [[{{tiddler.title}} +" Nav'']]'</div> >> >> The correct syntax for invoking this macro from a template is: >> <div macro='tiddler {{tiddler.title+" Nav''}}'></div> >> >> Breaking it apart a bit: >> <div macro='...'></div> >> is the template syntax for invoking a TW macro. Everything inside the >> quotes is handled exactly the same as when you embed a macro in an >> individual tiddler using TW syntax: a space-separated list of terms, >> where the first term is the macro name, and the remaining terms are >> the macro parameters >> >> In this case, it is the "tiddler" macro which, in normal TW content is >> written: >> <<tiddler TiddlerName>> >> and in templates, is written: >> <div macro='tiddler TiddlerName'></div> >> >> However, for your specific use-case, the macro's parameter has to be >> computed dynamically, in order to construct the desired 'Nav' tiddler >> title, relative to the tiddler in which the macro is being rendered. >> The syntax for a computed macro parameter (aka, an "eval param") is: >> <<macroName {{ ... javascript expression goes here ... }} etc>> >> where the entire {{...}} sequence is treated as a single term in the >> macro. Everything in between the {{ and }} is handed to your >> browser's javascript engine for evaluation, and the resulting value is >> then used as the value of that parameter, as if it had been typed in >> as literal text. >> >> Note: there are two 'context variables' that are automatically defined >> by the TW core's macro processor so that they are available for use >> within eval params: 'tiddler' is the TW 'store' object for the current >> tiddler being rendered in the story column, and 'place' is the DOM >> element into which the macro's output is to be rendered. >> >> Thus, in your case, the appropriate eval param would be: >> {{tiddler.title+" Nav''}} >> >> Hope this helps... >> >> enjoy, >> -e >> Eric Shulman >> TiddlyTools / ELS Design Studios >> >> >> > > > -- > http://www.multiurl.com/g/64 > > -- http://www.multiurl.com/g/64 --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---

