> Terrific advice. I am now able to call tabs macro from another macro,
> which I believe is a generic way to produce more customised tabs.

> var out = '!Display Tabs \n';
> out += "<<tabs txtMoreTab \"job no\" \"job no\"
> wikiinthefield_job_job001_jobNo \"customer address\" \"customer address
> \" wikiinthefield_job_job001_customerAddress \"customer phone\"
> \"customer phone\" wikiinthefield_job_job001_customerPhone>>";
> wikify(out, place);

There's no need to make a macro, just to encapsulate a bit of *static*
wiki syntax...

The general-purpose TW standard way to do this is by using the
<<tiddler>> macro to *transclude* the desired content, like this:

First, define a tiddler called, for example, [[CustomerTabs]],
containing:

<<tabs txtMoreTab "job no" "job no" wikiinthefield_job_job001_jobNo
"customer address" "customer address"
wikiinthefield_job_job001_customerAddress "customer phone" "customer
phone" wikiinthefield_job_job001_customerPhone>>

Then, without needing ANY custom macro code, you can simply embed
   <<tiddler CustomerTabs>>
in any other tiddler content to insert the above <<tabs>> macro
whereever you want.

In addition, let's suppose that you want to use the same
[[CustomerTabs]] tiddler to display tabs for *different* job numbers
(e.g., "job002", "job003", etc.).  This is also very easy to do using
the <<tiddler>> macro.

First, change the CustomerTabs definition, to replace all instances of
"001" with "$1", like this:

<<tabs txtMoreTab "job no" "job no" wikiinthefield_job_job$1_jobNo
"customer address" "customer address" wikiinthefield_job_job
$1_customerAddress "customer phone" "customer phone"
wikiinthefield_job_job$1_customerPhone>>

The "$1" sequence is a special "substitution marker".   When you
transclude the tiddler using the <<tiddler>> macro, add an extra
parameter to specify the desired job number, like this:

<<tiddler CustomerTabs with: "001">>
<<tiddler CustomerTabs with: "002">>
etc.

When the macro is processed, the content from CustomerTabs is read in,
and all instances of $1 within that content are automatically replaced
by the corresponding "with:" parameter value passed from the
<<tiddler>> macro.

(note: you can use $1 through $9 as markers in your content to
substitute up to 9 <<tiddler>> macro parameter values)

enjoy,
-e
Eric Shulman
TiddlyTools / ELS Design Studios

-- 
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.

Reply via email to