> This isn't a complete plugin in the TW sence.
Sure it is... A "plugin" is ANY tiddler containing javascript code
that is tagged with 'systemConfig'. Sure, *many* plugins define
macros or functions that are invoked later (after startup), but that
is not their only purpose. Some plugins are used to simply invoke
code during startup.
> So if you tagged it systemConfig the TW plugin manager can't handle
> it. That's why the error.
Actually, it has nothing to do with not being a "complete" plugin.
The problem is that functions such as story.displayTiddler() cannot be
directly invoked from a plugin during startup, because plugins are
loaded *before* the PageTemplate has been rendered and the
'displayArea' DOM element has not yet been created. Thus, there isn't
a valid 'place' in which to render the tiddler, resulting in the error
message that was reported.
> Have a look at tiddlywiki.org [1] for some basics. Also search for
> "macros", "plugins" "best practices" there, to get some more info.
> I have created some relatively "simple" button plugins, to get started
> with TW macro programming. Have a look at my helloworld space [2].
You can define a dummy macro that uses the 'init' function to invoke
code during startup, but *AFTER* the PageTemplate has been processed:
----------
config.macros.setup = {
init: function() {
/* your code here, e.g.: */
story.displayTiddler(null,'SomeTiddler');
}
}
----------
The macro name, 'setup', is really just a toss-away. Since there is
no handler() function defined, it won't actually be recognized as a
macro, but will still invoke it's init() function at the appropriate
time.
Another way to invoke code during startup, but after PageTemplate has
loaded is to embed the code into content that is displayed at startup
(e.g. MainMenu, SideBarOptions, etc.) You can use either
InlineJavascriptPlugin or a TWCore transclusion with evaluated
parameters, like this:
http://www.TiddlyTools.com/#InlineJavascriptPlugin
----------
<script>
story.displayTiddler(null,'SomeTiddler');
</script>
----------
TWCore transclusion with eval params:
----------
<<tiddler {{
story.displayTiddler(null,'SomeTiddler');
'';}}>>
----------
When the MainMenu (or other tiddler) is rendered, the code is invoked,
and the desired tiddler is displayed.
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
"TiddlyWikiDev" 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/tiddlywikidev?hl=en.