%SET{}%
to store arbitrary text in a named variable, and reuse it with %GET{}%
later on within the topic or an included topics. These variables live only during topic rendering time, e.g. they do not persist between topic views. This is an alternative to:
%CALC{$SET(some_name, anything)}%
and retrieved with $GET()
. These variables persist during page rendering time. A limitation of %CALC{}
is that it does not follow the standard TWiki variable evaluation order (nesting inside out, left to right).
%SET{}%
and %GET{}%
can be nested inside other TWiki variables and get handled as expected, e.g. inside out, and left to right.
%GET{}%
.
%SET{"name" value="..."}%
%SET{"lunch" value="Sushi"}%
%SET{}%
.
%GET{"name"}%
%GET{"lunch"}%
returns Sushi
if this has been previously set: %SET{"lunch" value="Sushi"}%
%<plugin>_<setting>%
, i.e. %NEWPLUGIN_SHORTDESCRIPTION%
data/debug.txt
) SetGetPlugin.zip
in your twiki installation directory. Content: File: | Description: |
---|---|
data/TWiki/SetGetPlugin.txt | Plugin topic |
lib/TWiki/Plugins/SetGetPlugin.pm | Plugin Perl module |
lib/TWiki/Plugins/SetGetPlugin/Core.pm | Core Perl module |
Result: Yes, it works!
Plugin Author: | TWiki:Main/PeterThoeny |
Copyright: | © 2010, TWiki:Main/PeterThoeny |
License: | GPL (GNU General Public License) |
Plugin Version: | 2010-10-17 (V1.0) |
Change History: | |
2010-10-17: | Initial version |
TWiki Dependency: | $TWiki::Plugins::VERSION 1.1 |
CPAN Dependencies: | none |
Other Dependencies: | none |
Perl Version: | 5.005 |
Benchmarks: | GoodStyle 100%, FormattedSearch 99%, SetGetPlugin 99% |
Plugin Home: | http://TWiki.org/cgi-bin/view/Plugins/SetGetPlugin |
Feedback: | http://TWiki.org/cgi-bin/view/Plugins/SetGetPluginDev |
Appraisal: | http://TWiki.org/cgi-bin/view/Plugins/SetGetPluginAppraisal |