I can not find out how to do this:
- Set some variables in tiddlers
- Use those variables in other tiddlers
The ideal would be to be able to generalise what is available with
SetTitle and SetSubtitle, and to be able to use them in any tiddler.
ex:
- tiddler BaseURL contains http://mysite/myproject/
- tiddler ProjectName contains MyProject
- In other tiddlers I would like to be able to write things such as
[[Home|$BaseURL]]
[[$MyProject Home|$BaseUrl+$ProjectName]]
(abviously with a correct syntax)
* An alternative would be to be able to write
var $BaseURL=http://mysite/myproject/
var $ProjectName=MyProject
Can one tell me if this is possible and how?
Sorry in advance if this is trivial. I've been fighting & seeking the
whole days without success
Thank you for your help
--LC
And if that doesn't help, try this:
http://tiddlywikiguides.org/index.php?title=Getting_started_with_custom_tiddler_fields
But if you want to do arbitrary mathematics you will probably need to
write your own Javascript.
;Daniel
--
Daniel Baird
http://tiddlyspot.com (free, effortless TiddlyWiki hosting)
http://danielbaird.com (TiddlyW;nks! :: Whiteboard Koala :: Blog ::
Things That Suck)
Take a look at this:
http://gimcrackd.com/etc/src/#set
http://gimcrackd.com/etc/src/#print
chris
Interesting indeed.
Works rather well except that I can not set variables at startup (in
systemConfig tiddler). I get "Error: SyntaxError: illegal XML
character" when plugins loads.
Thx
--
-- Laurent
2007/1/11, Daniel Baird <danie...@gmail.com>:
> It's not exactly what you want, but try this:
> http://tiddlywiki.com/#TiddlerSlicing
I would love to be able to use this.
But it seems to be for use within javascript or CSS.
Is it true?
I could not manage to have a [[Variables:MyVariable]] displayed as
'VariableValue' (set by 'MyVariable::VariableValue' within 'Variable
tiddler.
> And if that doesn't help, try this:
> http://tiddlywikiguides.org/index.php?title=Getting_started_with_custom_tiddler_fields
Thx. This is a nice tip too.
> But if you want to do arbitrary mathematics you will probably need to
> write your own Javascript.
Hopefully no... (yet...?)
> On 11/01/07, lch <lchar...@gmail.com> wrote:
> > I can not find out how to do this:
> > - Set some variables in tiddlers
> > - Use those variables in other tiddlers
> >
> > The ideal would be to be able to generalise what is available with
> > SetTitle and SetSubtitle, and to be able to use them in any tiddler.
> >
> > ex:
> > - tiddler BaseURL contains http://mysite/myproject/
> > - tiddler ProjectName contains MyProject
> > - In other tiddlers I would like to be able to write things such as
> > [[Home|$BaseURL]]
> > [[$MyProject Home|$BaseUrl+$ProjectName]]
> > (abviously with a correct syntax)
> >
> > * An alternative would be to be able to write
> > var $BaseURL=http://mysite/myproject/
> > var $ProjectName=MyProject
> >
> > Can one tell me if this is possible and how?
> >
> > Sorry in advance if this is trivial. I've been fighting & seeking the
> > whole days without success
> >
> > Thank you for your help
--
-- Laurent
I fixed it. Just a stupid copy/paste the pasted a '--' as a single long '-'.
I created a plugin with Jonah's common function, and another with the
set and print macros. It works perfectly, so far.
I can do in a GlobalVariables tiddler (tagged as systemConfig)
<<set BaseURL=http://mysite/myproject>>
<<set ProjectName=MyProject>>
And use it that way
<<print "[[My project|"+$URL+$ProjectName"]] or a tiddler [["+$ProjectName+"]]
Thank you for your help
--
-- Laurent
2007/1/12, Laurent CHARLES <lchar...@gmail.com>:
> I can do in a GlobalVariables tiddler (tagged as systemConfig)
> <<set BaseURL=http://mysite/myproject>>
> <<set ProjectName=MyProject>>
> And use it that way
> <<print "[[My project|"+$URL+$ProjectName"]] or a tiddler [["+$ProjectName+"]]
This works pretty well, but can not be loaded at startup directly to
setup variables.
I can put the GlobalVariables tid in the default tiddlers in first
position, or set variables in the first tiddler display at startup. A
rather dirty workaround in my opinion.
I would prefer to set GlobalVariables as systemConfig to have it
loaded automatically. But as is, it fails with an XML error, as, I
guess, the code is not properly js.
So, I'm calling again for help...
Thx
--
-- Laurent
I think that means this kind of thing will work:
eval(parse( "BaseURL=http://mysite/myproject"))
HTH
;Daniel
As this?
I have this only line in the Variables tiddler (systemConfig tag
only), and I get
Error: SyntaxError: invalid label
--
-- Laurent
maybe
eval(parse( "$BaseURL=http://mysite/myproject"))
?
config.macros['set'].run('my statement');
I'm working on a nicer way to do initial setup that doesn't require
this invocation. Daniel's right -- you have to make sure to put $s in
front of all variable names for it to work properly.
chris
I'm also interested in this topic, but totally mystified.
I've make a tiddlyspot called http://globalvariables.tiddlyspot.com/
and the password is "password"
I've put in my pathetic translation of what you're talking about and
have generated all sorts of errors. Would any of you TiddlySmart
people care to go in and tell me what we're doing wrong?
Many Thanks
Dave Parker
e.g.
$ColorPalette::PrimaryMid
It will be replaced with the text before the tiddler is formatted. And
yes, you can have things nested nicely.
Cheers,
Bradley
I may have some more questions about how to change the variable
remotely (i.e. from another tiddler), but I'd better try learning more
on my own first...
dp
Thank you all for your reply and hints.
I'm coming back to call for help.
I'm trying the "tiddler slices" as describes in Dave's
http://globalvariables.tiddlyspot.com/. It works well within "normal
tiddler text".
I also wonder if it would be possible to use such definitions within
"embedded html objects".
For ex:
<html>
<object type="text/html" data="http://www.tiddlywiki.com/#HelloThere">
</object>
</html>
And I'd like to use defs in the url (e.g. replace '#HelloThere' by
'<<tiddler "Variables::TiddlerRef">>'
I've also tried with the <<set>> and <<print>> macros.
<<print {{store.getTiddlerSlice("Variables","TiddlerRef")}}>> prints
it out, but combining it with strings or others <<print
"A="+{{store.getTiddlerSlice("Variables","TiddlerRef")}}>>, gives
either bad expression: invalid property id. I could also not achieve
to have this '{{store...}}' setting a variable value.
Any possibility?
Thankx for your help
--
-- Laurent
Is it something fixable, or IE is definitely out for TW?
Thx
2007/1/22, Laurent CHARLES <lchar...@gmail.com>:
--
-- Laurent