
| Line: 1 to 1 | ||||||||
|---|---|---|---|---|---|---|---|---|
| TWiki Plugins | ||||||||
| Line: 190 to 190 | ||||||||
| 
 | ||||||||
| Changed: | ||||||||
| < < | 
 | |||||||
| > > | 
 | |||||||
| 
 
 | ||||||||
| Line: 289 to 289 | ||||||||
| Config.specfiles are read during TWiki configuration. Once aConfig.spechas defined a configuration item, it is available for edit through the standardconfigureinterface.Config.specfiles are stored in the 'plugin directory' e.g.lib/TWiki/Plugins/BathPlugin/Config.spec. Structure of a  | ||||||||
| Changed: | ||||||||
| < < | The Config.specfile for a plugin starts with the plugin announcing what it is: | |||||||
| > > | The Config.specfile for an extension starts with the extension announcing what it is: | |||||||
| # ---+ BathPlugin # This plugin senses the level of water in your bath, and ensures the plug | ||||||||
| Line: 303 to 303 | ||||||||
| # *NUMBER* # Enter the chain length in cm | ||||||||
| Changed: | ||||||||
| < < | $TWiki::cfg{BathPlugin}{ChainLength} = '30'; | |||||||
| > > | $TWiki::cfg{BathPlugin}{ChainLength} = 30; | |||||||
| # *BOOLEAN EXPERT* | ||||||||
| Changed: | ||||||||
| < < | # Turn this option off to disable the water temperature alarm $TWiki::cfg{BathPlugin}{TempSensorEnabled} = '1'; | |||||||
| > > | # Set this option to 0 to disable the water temperature alarm $TWiki::cfg{BathPlugin}{TempSensorEnabled} = 1; | |||||||
| Changed: | ||||||||
| < < | The type (e.g. **SELECT**) tellsconfigureto how to prompt for the value. It also tells configure how to do some basic checking on the value you actually enter. All the comments between the type and the configuration item are taken as part of the description. The configuration item itself defines the default value for the configuration item. The above spec defines the configuration items$TWiki::cfg{BathPlugin}{PlugType},$TWiki::cfg{BathPlugin}{ChainLength}, and$TWiki::cfg{BathPlugin}{TempSensorEnabled}for use in your plugin. For example, | |||||||
| > > | The type (e.g. **SELECT**) tellsconfigureto how to prompt for the value. It also tellsconfigurehow to do some basic checking on the value you actually enter. All the comments between the type and the configuration item are taken as part of the description. The configuration item itself defines the default value for the configuration item. The above spec defines the configuration items$TWiki::cfg{BathPlugin}{PlugType},$TWiki::cfg{BathPlugin}{ChainLength}, and$TWiki::cfg{BathPlugin}{TempSensorEnabled}for use in your plugin. For example, | |||||||
| 
if( $TWiki::cfg{BathPlugin}{TempSensorEnabled} && $curTemperature > 50 ) {
    die "The bathwater is too hot for comfort";
}
 | ||||||||
| Changed: | ||||||||
| < < | The config.spec file is read by configure, and configurethen writesLocalSite.cfgwith the values chosen by the local site admin. | |||||||
| > > | The config.spec file is read by configure, which then writesLocalSite.cfgwith the values chosen by the local site admin. | |||||||
| A range of types are available for use in Config.specfiles: | ||||||||
| Line: 342 to 342 | ||||||||
| See lib/TWiki.specfor many more examples. | ||||||||
| Changed: | ||||||||
| < < | Config.specfiles are also used for other (non-plugin) extensions. in this case they are stored under theContribdirectory instead of thePluginsdirectory. | |||||||
| > > | Config.specfiles for non-plugin extensions are stored under theContribdirectory instead of thePluginsdirectory.
Note that from TWiki 5.0 onwards, CGI scripts (in the TWikibindirectory) provided by extensions must also have an entry in theConfig.specfile. This entry looks like this (example taken from PublishContrib)
# **PERL H**
# Bin script registration - do not modify
$TWiki::cfg{SwitchBoard}{publish} = [ "TWiki::Contrib::Publish", "publish", { publishing => 1 } ];
PERLspecifies a perl data structure, andHa hidden setting (it won't appear inconfigure). The first field of the data value specifies the class where the function that implements the script can be found. The second field specifies the name of the function, which must be the same as the name of the script. The third parameter is a hash of initial context settings for the script. | |||||||
| TWiki:TWiki/SpecifyingConfigurationItemsForExtensions  has supplemental documentation on configure settings. | ||||||||
 
  Copyright © 1999-2025 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Copyright © 1999-2025 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.