TWiki Variables

Special text strings expand on the fly to display user data or system info

TWikiVariables are text strings - %VARIABLE% - that expand into content whenever a page is rendered for viewing. VARIABLES are replaced by data, either user-entered or automatically generated by TWiki (like the date, or the current username). There are predefined variables, and Preference variables that you can configure. You can also define custom variables, with new names and values.

Notes:

Predefined Variables

Most predefined variables return values that were either set in the lib/twiki.cfg file, when TWiki was installed, or taken from server info (like current username, or date and time). Many of the variables let you format the appearance of the display results.

This version of TWiki - 04 Sep 2004 $Rev: 1742 $ - expands the following variables (enclosed in % percent signs):

ATTACHURL -- full URL for attachments in the current topic

ATTACHURLPATH -- path of the attachment URL of the current topic

BASETOPIC -- base topic where an INCLUDE started

BASEWEB -- base web where an INCLUDE started

DISPLAYTIME -- display time

DISPLAYTIME{"format"} -- formatted display time

ENCODE{"string"} -- encodes a string

FORMFIELD{"format"} -- renders a field in the form attached to some topic

GMTIME -- GM time

GMTIME{"format"} -- formatted GM time

HOMETOPIC -- home topic in each web

HTTP_HOST -- environment variable

ICON{"type"} -- small icon of common attachment types

INCLUDE{"page"} -- include other topics or web pages

INCLUDINGTOPIC -- name of topic that includes current topic

INCLUDINGWEB -- web that includes current topic

MAINWEB -- name of Main web

METASEARCH -- special search of meta data

NOTIFYTOPIC -- name of the notify topic

PLUGINVERSION -- the version of the TWiki Plugin API

PLUGINVERSION{"name"} -- the version of an installed Plugin

PUBURL -- the base URL of attachments

PUBURLPATH -- the base URL path of attachments

REMOTE_ADDR -- environment variable

REMOTE_PORT -- environment variable

REMOTE_USER -- environment variable

REVINFO -- revision information of current topic

REVINFO{"format"} -- formatted revision information of topic

SCRIPTURL -- script URL of TWiki

SCRIPTURLPATH -- script URL path of TWiki

SCRIPTSUFFIX -- script suffix

SEARCH{"text"} -- search content

SERVERTIME -- server time

SERVERTIME{"format"} -- formatted server time

SPACEDTOPIC -- topic name, spaced and encoded

STARTINCLUDE -- start position of topic text if included

STATISTICSTOPIC -- name of statistics topic

STOPINCLUDE -- end position of topic text if included

TOC -- table of contents of current topic

TOC{"Topic"} -- table of contents

TOPIC -- name of current topic

TOPICLIST{"format"} -- topic index of a web

TWIKIWEB -- name of TWiki documentation web

URLPARAM{"name"} -- get value of a URL parameter

USERNAME -- your login username

VAR{"NAME" web="Web"} -- get a preference value from another web

WEB -- name of current web

WEBLIST{"format"} -- index of all webs

WEBPREFSTOPIC -- name of web preferences topic

WIKIHOMEURL -- site home URL

WIKINAME -- your Wiki username

WIKIPREFSTOPIC -- name of site-wide preferences topic

WIKITOOLNAME -- name of your TWiki site

WIKIUSERNAME -- your Wiki username with web prefix

WIKIUSERSTOPIC -- name of topic listing all registers users

WIKIVERSION -- the version of the installed TWiki engine

Note: Above text is included from TWikiVariablesAtoM and TWikiVariablesNtoZ

Preferences Variables

Additional variables are defined in the preferences topics:

Variable: Level: What: Expands to:
%ALLOWTOPICCHANGE% (any topic) List of users and groups who are allowed to change the current topic. (More in TWikiAccessControl) TWikiAdminGroup  
%ALLOWTOPICRENAME% (any topic) List of users and groups who are allowed to rename the current topic. (More in TWikiAccessControl) TWikiAdminGroup  
%ALLOWWEBCHANGE% WL List of users and groups who are allowed to change topics in the TWiki web. (More in TWikiAccessControl) OrchesterAdminGroup  
%ALLOWWEBRENAME% WL List of users and groups who are allowed to rename topics in the TWiki web. (More in TWikiAccessControl) OrchesterAdminGroup  
%ATTACHLINKBOX% SL , UL Default state of the link check box in the attach file page. Check box is initially checked if value is set to CHECKED , unchecked if empty. If checked, a link is created to the attached file at the end of the topic. Value is:  
%DENYTOPICCHANGE% (any topic) List of users and groups who are not allowed to change the current topic. (More in TWikiAccessControl) %DENYTOPICCHANGE%  
%DENYTOPICRENAME% (any topic) List of users and groups who are not allowed to rename the current topic. (More in TWikiAccessControl) %DENYTOPICRENAME%  
%DENYWEBCHANGE% WL List of users and groups who are not allowed to change topics in the TWiki web. (More in TWikiAccessControl)  
%DENYWEBRENAME% WL List of users and groups who are not allowed to rename topics in the TWiki web. (More in TWikiAccessControl)  
%DONTNOTIFYCHECKBOX% SL , UL Default state of the "Minor Changes, Don't Notify" (DontNotify) check box in preview. Check box is initially checked if Set DONTNOTIFYCHECKBOX = checked="checked", or unchecked if empty. Value is: checked checked  
%EDITBOXHEIGHT% SL , UL Vertical size of edit box, is 15 15  
%EDITBOXWIDTH% SL , UL Horizontal size of edit box, is 70 70  
%EDITBOXSTYLE% SL , UL Style of text edit box. Set to width: 99% for full window width (default; overwrites the EDITBOXWIDTH setting), or width: auto to disable. Value is: width: 99% width: 99%  
%FINALPREFERENCES% SL , WL List of preferences that are not allowed to be overridden by next level preferences ATTACHFILESIZELIMIT, PREVIEWBGIMAGE, WIKITOOLNAME, WIKIWEBMASTER, SMTPMAILHOST, SMTPSENDERHOST, ALLOWWEBMANAGE, READTOPICPREFS, TOPICOVERRIDESUSER, NOSEARCHALL, ATTACHFILESIZELIMIT, WIKIWEBMASTER, WEBCOPYRIGHT, WEBTOPICLIST, DENYWEBVIEW, ALLOWWEBVIEW, DENYWEBCHANGE, ALLOWWEBCHANGE, DENYWEBRENAME, ALLOWWEBRENAME  
%HTTP_EQUIV_ON_EDIT% SL , UL http-equiv meta tags for edit script.  
%HTTP_EQUIV_ON_PREVIEW% SL , UL http-equiv meta tags for preview script.  
%HTTP_EQUIV_ON_VIEW% SL http-equiv meta tags for view, rdiff, attach, search* scripts.  
%NEWTOPICBGCOLOR% SL , UL Background color of non existing topic. ( UL needs authentication for topic views ) #FFFFCE  
%NEWTOPICFONTCOLOR% SL , UL Font color of non existing topic. ( UL needs authentication for topic views ) #0000FF  
%NOSEARCHALL% WL Exclude web from a web="all" search (set variable to on for hidden webs)  
%RELEASEEDITLOCKCHECKBOX% SL , UL Default state of the "Release edit lock" (UnlockTopic) check box in preview. Checkbox is initially checked if Set RELEASEEDITLOCKCHECKBOX = checked="checked", or unchecked if empty. If checked, make sure to click on Edit to do more changes; do not go back in your browser to the edit page, or you risk that someone else will edit the topic at the same time! Value is:  
%WEBBGCOLOR% WL Background color of web #FFD8AA  
%WEBCOPYRIGHT% SL , WL Copyright notice (bottom right corner of topics) Copyright © 1999-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback  
%WEBTOPICLIST% WL Common links of web (second line of topics) Welcome | Register | Changes | Topics | Index | Search | Go  
%WIKIWEBLIST% SL List of TWiki webs (in upper right corner of topics) Main | TWiki | Sandbox  
%WIKIWEBMASTER% SL Webmaster email address (sender of email notifications) , is i9110102@tu-bs.de i9110102@tu-bs.de  

Note: There are some more useful variables defined in the TWikiPreferences like %BR% for line break, colors like %RED% for colored text and small icons like %H% for a HELP Help icon.

Setting Preferences

Creating Custom Variables

Example: Create a custom logo variable the TWiki web

-- TWiki:Trash.PeterThoeny - 14 Aug 2004
-- TWiki:Main.MikeMannix - 12 May 2002

Crawford split up this topic into included TWikiVariablesAtoM and TWikiVariablesNtoZ.

-- PeterThoeny? - 26 Jul 2004