NOTE: This is a
DistributionDocument.
- Please help maintain high quality documentation:
This is a wiki, please
fix the documentation if you find errors or incomplete content.
Put questions and suggestions concerning the documentation of this topic in the comments section below.
Use the Support web for problems you are having using TWiki.
Use the Sandbox web to evaluate & test TWiki.
Empty TWiki Plugin
This is an empty Plugin you can use as a template to build your own
TWikiPlugins. This Plugin does nothing, but is ready to be used.
To create your own Plugin:
- Copy file
TWiki/Plugins/EmptyPlugin.pm
to <name>Plugin.pm
and customize the plugin.
- Create a
<name>Plugin
topic in the TWiki06x01 web. Do so by visiting http://TWiki.org/cgi-bin/view/Plugins/PluginPackage#NewPlugin and starting a new topic to get the default plugin topic text (don't save the topic). Customize your plugin topic to your needs.
- See details in TWikiPlugins.
Syntax Rules
(none)
Plugin Settings
Plugin settings are stored as preferences variables. To reference
a plugin setting write
%<plugin>_<setting>%
, i.e.
%EMPTYPLUGIN_SHORTDESCRIPTION%
- One line description, is shown in the TextFormattingRules topic:
- Set SHORTDESCRIPTION = Empty Plugin used as a template for new Plugins
- Your own setting, for example:
- Debug plugin: ( TWiki sets
$debug
in your plugin. See output in data/debug.txt
.)
Plugin Installation Instructions
- This plugin is preinstalled, you do not need to install it.
Plugin Info
Related Topics: TWikiPlugins,
DeveloperDocumentationCategory,
AdminDocumentationCategory,
TWikiPreferences
--
TWikiContributor - 01 Feb 2006
Comments & Questions about this Distribution Document Topic
I modified this a bit to try and indicate that your plugin doesn't have to test for the DEBUG variable, as that wasn't obvious to me. If it is obvious to everyone else, you can take it back out...
I'm also looking for a place to add some comments about the
EmptyPlugin, or more correctly, the functions in it. For example, what's a REST handler? I found some tidbits about it on the web, but it isn't really well explained.
More importantly, I'd like to point out somewhere that, if you
registerTagHandler
, you can return stuff, which gets inserted into the TWiki page. If you return undef, then the original text gets output. Or, you can return error diagnostics. (note, my previous version of this comment had a "stupid coder error" in it, which I've fixed). None of this is documented--at least as far as I could find--anywhere. And I couldn't find a place where it
could be documented, short of modifying
EmptyPlugin.pm
over in subversion, which I'm not quite ready to do yet.
Another thing: The example shows getting a config variable,
$exampleCfgVar
, which is defined as a
my
variable in
initPlugin
. Unless the variable is
only used in
initPlugin
, having it be scoped to just that function won't be particularly helpful. But it isn't clear from the documentation if it is ok to just declare it as a global. I think that would make mod_perl unhappy, but I'm not sure.
I guess there needs to be some more documentation on this whole plugin thing, eh? Which gets back to the "where" question in my second paragraph...
--
DougClaar - 10 May 2006