%VARIABLE% or %VARIABLE{ parameter="value" }% - that expand into content whenever a topic is rendered for viewing. There are two types of variables: %CALC{}% variable)
%T% to get %TOPIC% to get TWikiVariables (a predefined variable)
%CALC{ "$UPPER(Text)" }% to get TEXT (a variable defined by Plugin)
!%TOPIC% to get %TOPIC%
%ALLVARIABLES% to get a full listing of all variables defined for a particular topic
%MYVAR%, %MyVar%, %My2ndVar%, and %My_Var% are all valid variable names. Variables are case sensitive. %MyVAR% and %MYVAR% are not the same variable.
By convention all settings, predefined variables and variables used by plugins are always UPPER-CASE.
Preview will show the wrong thing, and you must Save the topic to see it correctly.
The syntax for setting Variables is the same anywhere in TWiki (on its own TWiki bullet line, including nested bullets): [multiple of 3 spaces] * [space] Set [space] VARIABLENAME [space] = [space] value
Examples:Spaces between the = sign and the value will be ignored. You can split a value over several lines by indenting following lines with spaces - as long as you don't try to use * as the first character on the following line.
Set VARIABLENAME = value
Set VARIABLENAME = value
Example:
* Set VARIABLENAME = value starts here
and continues here
Whatever you include in your Variable will be expanded on display, exactly as if it had been entered directly.
Example: Create a custom logo variableYou can also set preferences variables on a topic by clicking the link
- To place a logo anywhere in a web by typing
%MYLOGO%, define the Variable on the web's WebPreferences topic, and upload a logo file, ex:mylogo.gif. You can upload by attaching the file to WebPreferences, or, to avoid clutter, to any other topic in the same web, e.g.LogoTopic. Sample variable setting in WebPreferences:
Set MYLOGO = %PUBURL%/%WEB%/LogoTopic/mylogo.gif
Edit topic preference settings under More topic actions. Preferences set in this manner are not visible in the topic text, but take effect nevertheless.
Local in place of Set in the variable definition. For example, if the user sets the following in their home topic:
* Set EDITBOXHEIGHT = 10 * Local EDITBOXHEIGHT = 20Then when they are editing any other topic, they will get a 10 high edit box. However when they are editing their home topic, they will get a 20 high edit box.
Local can be used wherever a preference needs to take a different value depending on where the current operation is being performed.
Use this powerful feature with great care! %ALLVARIABLES% can be used to get a listing of the values of all variables in their evaluation order, so you can see variable scope if you get confused.
%BR% - line break
%BULLET% - bullet sign
%BB% - line break and bullet combined
%BB2% - indented line break and bullet
%RED% text %ENDCOLOR% - colored text (also %YELLOW%, %ORANGE%, %PINK%, %PURPLE%, %TEAL%, %NAVY%, %BLUE%, %AQUA%, %LIME%, %GREEN%, %OLIVE%, %MAROON%, %BROWN%, %BLACK%, %GRAY%, %SILVER%, %WHITE%)
%H% - %I% - %M% - %N% - %P% - %Q% - %S% - %T% - %U% - %X% - %Y% - %SEARCH%, are powerful and general tools.
%INCLUDINGTOPIC%, %INCLUDE%, and the mighty %SEARCH%.
%ACTIVATEDPLUGINS%
%ALLVARIABLES%
AQUA is one of the rendering shortcut settings predefined in TWikiPreferences. See the section rendering shortcut settings in that topic for a complete list of colors.
%AQUA% aqua text %ENDCOLOR%
%<color>% text must end with %ENDCOLOR%. If you want to switch from one color to another one you first need to end the active color with %ENDCOLOR%, e.g. write %RED% some text %ENDCOLOR% %GREEN% more text %ENDCOLOR%.
%ATTACHURL%
http://wiki.issuecrawler.net/pub/TWiki/VarATTACHURL
%ATTACHURL%/image.gif
%ATTACHURLPATH%
/pub/TWiki/VarATTACHURLPATH
%AUTHREALM%
%TOPIC% if there is no INCLUDE
%BASETOPIC%
%WEB% in case there is no include.
%BASEWEB%
BLACK is one of the rendering shortcut settings predefined in TWikiPreferences. See the section rendering shortcut settings in that topic for a complete list of colors.
%BLACK% black text %ENDCOLOR%
%<color>% text must end with %ENDCOLOR%. If you want to switch from one color to another one you first need to end the active color with %ENDCOLOR%, e.g. write %RED% some text %ENDCOLOR% %GREEN% more text %ENDCOLOR%.
BLUE is one of the rendering shortcut settings predefined in TWikiPreferences. See the section rendering shortcut settings in that topic for a complete list of colors.
%BLUE% blue text %ENDCOLOR%
%<color>% text must end with %ENDCOLOR%. If you want to switch from one color to another one you first need to end the active color with %ENDCOLOR%, e.g. write %RED% some text %ENDCOLOR% %GREEN% more text %ENDCOLOR%.
BROWN is one of the rendering shortcut settings predefined in TWikiPreferences. See the section rendering shortcut settings in that topic for a complete list of colors.
%BROWN% brown text %ENDCOLOR%
%<color>% text must end with %ENDCOLOR%. If you want to switch from one color to another one you first need to end the active color with %ENDCOLOR%, e.g. write %RED% some text %ENDCOLOR% %GREEN% more text %ENDCOLOR%.
%CALC{"formula"}% variable is handled by the SpreadSheetPlugin. There are around 80 formulae, such as $ABS(), $EXACT(), $EXISTS(), $GET()/$SET(), $IF(), $LOG(), $LOWER(), $PERCENTILE(), $TIME(), $VALUE().
%CALC{"formula"}%
%CALC{"$SUM($ABOVE())"}% returns the sum of all cells above the current cell
%CALC{"$EXISTS(Web.SomeTopic)"}% returns 1 if the topic exists
%CALC{"$UPPER(Collaboration)"}% returns COLLABORATION
%COMMENT% without parameters shows a simple text box.
| Name | Description | Default |
|---|---|---|
type | This is the name of the template to use for this comment. Comment templates are defined in a TWiki template - see Customisation, below. If this attribute is not defined, the type is whatever is defined by COMMENTPLUGIN_DEFAULT_TYPE, either in this topic or in your WebPreferences. | below |
default | Default text to put into the textarea of the prompt. | |
target | Name of the topic to add the comment to | the current topic |
location | Regular expression specifying the comment location in the target topic. Read carefully the CommentPlugin documentation! | |
mode | For compatibility with older versions only, synonymous with type | |
nonotify | Set to "on" to disable change notification for target topics | off |
noform | Set to "on" to disable the automatic form that encloses your comment block - remember to insert <form> tags yourself! See CommentPluginExamples#noform for an example. | off |
nopost | Set to "on" to disable insertion of the posted text into the topic. | off |
remove | Set to "on" to remove the comment prompt after the first time it is clicked. | off |
button | Button label text | Add comment |
%DATE%
21 Nov 2008
%DISPLAYTIME%
21 Nov 2008 - 21:12
%GMTIME%
%DISPLAYTIME{"format"}%
%DISPLAYTIME{"$hou:$min"}% expands to 21:12
text, then hide the form. If EDITACTION is defined as form hide the normal text area and only edit the form.
;action=text or ;action=form to the URL for the edit script. If you have defined EDITACTION in a topic setting or preference setting you can still edit the topic content or the form by removing the ;action=form or ;action=text from the edit URL in the browser and reload.
%EDITTABLE{}% variable is handled by the EditTablePlugin
%EDITTABLE{ attributes }%
| Attribute | Comment | Default |
|---|---|---|
header | Specify the header format of a new table like "|*Food*|*Drink*|". Useful to start a table with only a button | (no header) |
format | The format of one column when editing the table. A cell can be a text input field, or any of these edit field types: • Text input field (1 line): | text, <size>, <initial value> | • Textarea input field: | textarea, <rows>x<columns>, <initial value> | • Drop down box: | select, <size>, <option 1>, <option 2>, etc* | * only one item can be selected • Radio buttons: | radio, <size*>, <option 1>, <option 2>, etc | * size indicates the number of buttons per line in edit mode • Checkboxes: | checkbox, <size*>, <option 1>, <option 2>, etc | * size indicates the number of checkboxes per line in edit mode • Fixed label: | label, 0, <label text> | • Row number: | row, <offset> | • Date: | date, <size>, <initial value>, <DHTML date format> | (see Date Field Type) | "text, 16" for all cells |
changerows | Rows can be added and removed if "on" Rows can be added but not removed if "add" Rows cannot be added or removed if "off" | CHANGEROWS plugin setting |
quietsave | Quiet Save button is shown if "on", hidden if "off" | QUIETSAVE plugin setting |
include | Other topic defining the EDITTABLE parameters. The first %EDITTABLE% in the topic is used. This is useful if you have many topics with the same table format and you want to update the format in one place. | (none) |
helptopic | Topic name containing help text shown below the table when editing a table. The %STARTINCLUDE% and %STOPINCLUDE% variables can be used in the topic to specify what is shown. | (no help text) |
headerislabel | Table header cells are read-only (labels) if "on"; header cells can be edited if "off" or "0" | "on" |
editbutton | Set edit button text, e.g. "Edit this table"; set button image with alt text, e.g. "Edit table, %PUBURL%/%TWIKIWEB%/TWikiDocGraphics/edittopic.gif"; hide edit button at the end of the table with "hide" (Note: Button is automatically hidden if an edit button is present in a cell) | EDITBUTTON plugin setting |
javascriptinterface | Use javascript to directly move and delete row without page refresh. Enable with "on", disable with "off". | JAVASCRIPTINTERFACE plugin setting |
%EDITTABLE{ format="| text, 20 | select, 1, one, two, three |" changerows="on" }% | *Name* | *Type* | | Foo | two |
"\n") and linefeed ("\r")
"<", ">", "&", single quote (') and double quote (")
"%", "[", "]", "@", "_", "*", "=" and "|"
%ENCODE{"string"}%
| Parameter: | Description: | Default: |
|---|---|---|
"string" | String to encode | required (can be empty) |
type="entity" | Encode special characters into HTML entities, like a double quote into ". Does not encode \n or \r. | type="url" |
type="html" | As type="entity" except it also encodes \n and \r | type="url" |
type="quotes" | Escape double quotes with backslashes (\"), does not change other characters | type="url" |
type="url" | Encode special characters for URL parameter use, like a double quote into %22 | (this is the default) |
%ENCODE{"spaced name"}% expands to spaced%20name
<input type="text" name="address" value="%ENCODE{ "any text" type="entity" }%" />
%SEARCH{ "%ENCODE{ "string with "quotes"" type="quotes" }%" noheader="on" }%
ENDCOLOR is a rendering shortcut settings predefined in TWikiPreferences. See the section rendering shortcut settings in that topic for a complete list of colors.
%RED% red text %ENDCOLOR%
%<color>% text must end with %ENDCOLOR%. If you want to switch from one color to another one you first need to end the active color with %ENDCOLOR%, e.g. write %RED% some text %ENDCOLOR% %GREEN% more text %ENDCOLOR%.
%ENDSECTION{"name"}%
%ENDSECTION{type="include"}%
| Parameter: | Description: |
|---|---|
"name" | Name of the section. |
type="..." | Type of the section being terminated; supported types "section", "include", "templateonly". |
STARTSECTION is named, the corresponding ENDSECTION must also be named with the same name. If the STARTSECTION specifies a type, then the corresponding ENDSECTION must also specify the same type. If the section is unnamed, ENDSECTION will match with the nearest unnamed %STARTSECTION% of the same type above it.
{AccessibleENV} in the Security Settings/Miscellaneous section of configure can be displayed. Any other variable will just be shown as an empty string, irrespective of its real value.
%ENV{MOD_PERL}% displays as: not set
not set.
%FAILEDPLUGINS%
%FORMFIELD{"fieldname"}%
| Parameter: | Description: | Default: |
|---|---|---|
"fieldname" | The name of a TWiki form field | required |
topic="..." | Topic where form data is located. May be of the form Web.TopicName | Current topic |
format="..." | Format string. $value expands to the field value, and $title expands to the fieldname (also expands $name, $attributes, $type, $size and $definingTopic) | "$value" |
default="..." | Text shown when no value is defined for the field | "" |
alttext="..." | Text shown when field is not found in the form | "" |
%FORMFIELD{"ProjectName" topic="Projects.SushiProject" default="(not set)" alttext="ProjectName field found"}%
%GMTIME%
21 Nov 2008 - 21:12
%GMTIME{"format"}%
| Variable: | Unit: | Example |
|---|---|---|
$seconds | seconds | 59 |
$minutes | minutes | 59 |
$hours | hours | 23 |
$day | day of month | 31 |
$wday | day of the Week (Sun, Mon, Tue, Wed, Thu, Fri, Sat) | Thu |
$dow | day of the week (Sun = 0) | 2 |
$week | number of week in year (ISO 8601) | 34 |
$month | short name of month | Dec |
$mo | 2 digit month | 12 |
$year | 4 digit year | 1999 |
$ye | 2 digit year | 99 |
$tz | either "GMT" (if set to gmtime), or "Local" (if set to servertime) | GMT |
$iso | ISO format timestamp | 2008-11-21T21:12:37Z |
$rcs | RCS format timestamp | 2008/11/21 21:12:37 |
$http | E-mail & http format timestamp | Fri, 21 Nov 2008 21:12:37 GMT |
$epoch | Number of seconds since 00:00 on 1st January, 1970 | 1227301957 |
%GMTIME{"$day $month, $year - $hour:$min:$sec"}% expands to 21 Nov, 2008 - 21:12:37
GRAY is one of the rendering shortcut settings predefined in TWikiPreferences. See the section rendering shortcut settings in that topic for a complete list of colors.
%GRAY% gray text %ENDCOLOR%
%<color>% text must end with %ENDCOLOR%. If you want to switch from one color to another one you first need to end the active color with %ENDCOLOR%, e.g. write %RED% some text %ENDCOLOR% %GREEN% more text %ENDCOLOR%.
GREEN is one of the rendering shortcut settings predefined in TWikiPreferences. See the section rendering shortcut settings in that topic for a complete list of colors.
%GREEN% green text %ENDCOLOR%
%<color>% text must end with %ENDCOLOR%. If you want to switch from one color to another one you first need to end the active color with %ENDCOLOR%, e.g. write %RED% some text %ENDCOLOR% %GREEN% more text %ENDCOLOR%.
%GROUPS%
%HOMETOPIC%
WebHome, renders as WebHome
%HTTP%
%HTTP{"Header-name"}%
%HTTP% | |
%HTTP{"Accept-language"}% | en-us,en;q=0.5 |
%HTTP{"User-Agent"}% | CCBot/1.0 (+http://www.commoncrawl.org/bot.html) |
%HTTP_HOST%
wiki.issuecrawler.net
%HTTP% but operates on the HTTPS environment variables present when the SSL protocol is in effect. Can be used to determine whether SSL is turned on.
%HTTPS%
%HTTPS{"Header-name"}%
%ICON{"name"}%
%ICON{"flag-gray"}% returns %ICON{"pdf"}% returns %ICON{"smile.pdf"}% returns %ICON{"/dont/you/dare/smile.pdf"}% returns %ICON{"http://twiki.org/doc/xhtml.xsl"}% returns arrowbright, bubble, choice-yes, hand
bmp, doc, gif, hlp, html, mp3, pdf, ppt, txt, xls, xml, zip
%ICON{"name"}% generates the full HTML img tag. Specify image name or full filename (see ICON for details on filenames.)
%ICONURL{"name"}%
%ICONURL{"arrowbright"}% returns http://wiki.issuecrawler.net/pub/TWiki/TWikiDocGraphics/arrowbright.gif
%ICONURL{"novel.pdf"}% returns http://wiki.issuecrawler.net/pub/TWiki/TWikiDocGraphics/pdf.gif
%ICONURL{"/queen/boheme.mp3"}% returns http://wiki.issuecrawler.net/pub/TWiki/TWikiDocGraphics/mp3.gif
%ICONURLPATH{"name"}%
%ICONURLPATH{"locktopic"}% returns /pub/TWiki/TWikiDocGraphics/locktopic.gif
%ICONURLPATH{"eggysmell.xml"}% returns /pub/TWiki/TWikiDocGraphics/xml.gif
%ICONURLPATH{"/doc/xhtml.xsl"}% returns /pub/TWiki/TWikiDocGraphics/xsl.gif
%IF{"CONDITION" then="THEN" else="ELSE"}% shows "THEN" if "CONDITION" evaluates to TRUE, otherwise "ELSE" will be shown
%IF{"defined FUNFACTOR" then="FUNFACTOR is defined" else="FUNFACTOR is not defined"}% renders as FUNFACTOR is not defined
%INCLUDE{"page" ...}%
| Parameter: | Description: | Default: |
|---|---|---|
"SomeTopic" | The name of a topic located in the current web, i.e. %INCLUDE{"WebNotify"}% | |
"Web.Topic" | A topic in another web, i.e. %INCLUDE{"TWiki.SiteMap"}% | |
"http://..." | A full qualified URL, i.e. %INCLUDE{"http://twiki.org:80/index.html"}%. Supported content types are text/html and text/plain. | |
pattern="..." | Include a subset of a topic or a web page. Specify a RegularExpression that scans from start ('^') to end and contains the text you want to keep in parenthesis, e.g., pattern="^.*?(from here.*?to here).*". IncludeTopicsAndWebPages has more. | none |
rev="2" | Include a previous topic revision; N/A for URLs | top revision |
raw="on" | When a page is included, normally TWiki will process it, doing the following: 1) Alter relative links to point back to originating host, 2) Remove some basic HTML tags (html, head, body, script) and finally 3) Remove newlines from HTML tags spanning multiple lines. If you prefer to include exactly what is in the source of the originating page set this to on. raw="on" is short for disableremoveheaders="on", disableremovescript="on", disableremovebody="on", disablecompresstags="on" and disablerewriteurls="on". | disabled |
literal="on" | While using the raw option will indeed include the raw content, the included content will still be processed and rendered like regular topic content. To disable parsing of the included content, set the literal option to "on". | disabled |
disableremoveheaders="on" | Bypass stripping headers from included HTML (everything until first </head> tag) | disabled |
disableremovescript="on" | Bypass stripping all <script> tags from included HTML | disabled |
disableremovebody="on" | Bypass stripping the </body> tag and everything around over and below it | disabled |
disablecompresstags="on" | Bypass replacing newlines in HTML tags with spaces. This compression step rewrites unmatched <'s into < entities unless bypassed | disabled |
disablerewriteurls="on" | Bypass rewriting relative URLs into absolute ones | disabled |
warn="off" | Warn if topic include fails: Fail silently (if off); output default warning (if set to on); else, output specific text (use $topic for topic name) | %INCLUDEWARNING% preferences setting |
section="name" | Includes only the specified named section, as defined in the included topic by the STARTSECTION and ENDSECTION variables. Nothing is shown if the named section does not exists. section="" is equivalent to not specifying a section | |
PARONE="val 1" | Any other parameter will be defined as a variable within the scope of the included topic. The example parameters on the left will result in %PARONE% and %PARTWO% being defined within the included topic. |
disableremovescript parameter)