On Aug 13, 12:00 am, Eric Shulman <
elsdes...@gmail.com> wrote:
> > <<tabs txtFavourite
> > One "One" [[NewTemplate/One]]
> > Two "Two" [[NewTemplate/Two]]
> > Three "Three" [[NewTemplate/Three]]
>
> > Now, the complication is that when I create a tiddler based on this
> > (with newTiddler) I want the "NewTemplate" in the tabs substituted by
> > the new title. I tried several combinations:
>
> Hi David!
>
> Welcome to the party... it seems that you've jumped right into the
> deep end :-)
>
> Give this a try:
>
> First, install
>
http://www.TiddlyTools.com/#CoreTweaks
> (specifically, see ticket #444,
http://trac.tiddlywiki.org/ticket/444)
> This will add a 'fixup' for the global variable, 'tiddler', which is a
> reference to the current tiddler object, and is available for use in
> *evaluated macro parameters*, like this:
>
> <<tabs txtFavourite
> One "One" {{tiddler.title+"/One"}}
> Two "Two" {{tiddler.title+"/Two"}}
> Three "Three" {{tiddler.title+"/Three"}}>>
Hi,
Thanks, it works like a charm! Just for the record, I write here my
solution for a tabbed address book with no forms. I have installed the
plugins CoreTweaks, EditTiddlerPlugin, ForEachTiddlerPlugin (which I
don't use) and InlineJavascriptPlugin.
1. Create "TemplateContact" with the text:
<<tabs txtFavourite
Main "Main" {{tiddler.title+"/Main"}}
Work "Work" {{tiddler.title+"/Work"}}
Personal "Personal" {{tiddler.title+"/Personal"}}
Misc "Misc" {{tiddler.title+"/Misc"}}
>>
In this way, a tiddler "Person" created with this content will have
tabs whose contents are those of "Person/Main", etc.
2. Create "TemplateContact/Main" etc. according to your own needs. A
sample:
@@display:block;text-align:right;<<editTiddler here "change
me">>@@First name:
Last name:
Birthday:
(The thing between the "@@" will create a "change me" button that will
edit "Person/Main" once we have created the contact "Person" in the
following step)
3. Now create "NewContact" which will contain the code that creates
all the tiddlers:
<script label="click here">
var title = prompt("Please enter contact's name", "");
store.saveTiddler(title+"/Main", title+"/Main",
store.getTiddler("TemplateContact/Main").text,
config.options.txtUserName, new Date());
store.saveTiddler(title+"/Work", title+"/Work",
store.getTiddler("TemplateContact/Work").text,
config.options.txtUserName, new Date());
store.saveTiddler(title+"/Personal", title+"/Personal",
store.getTiddler("TemplateContact/Personal").text,
config.options.txtUserName, new Date());
store.saveTiddler(title+"/Misc", title+"/Misc",
store.getTiddler("TemplateContact/Misc").text,
config.options.txtUserName, new Date());
store.saveTiddler(title, title,
store.getTiddler("TemplateContact").text, config.options.txtUserName,
new Date(),["Tag1","Better tagged"]);
story.displayTiddler(null, title, DEFAULT_VIEW_TEMPLATE);
</script>
4. This tiddler will have "click here", which will prompt for a title
when clicked. Let's say that we type "Example". Then it will create
"Example/Main" (with the contents of "TemplateContact/Main"), etc.,
and "Example" with the same contents as "TemplateContact", so that the
tabs will show the newly created tiddlers. "Example" will have tags
"Tag1" and "Better tagged" in this case.
5. Once it works, customize at will: change the template and
subtemplates to whatever you need.
I hope it's more or less clear... any comments appreciated!
Regards,
David