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 opened. When a topic is rendered for viewing, VARIABLES are replaced by data, either user-entered, or info automatically generated by TWiki (like the date, or the current username). There are predefined variables, and Preference variables that you configure. You can also define custom variables, with new names and values.

Note: To leave a variable unexpanded, preceed it with an exclamation point, e.g. type !%TOPIC% to get %TOPIC%.

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 - Alpha 30 Jul 2004 $Rev: 1701 $ - expands the following variables (enclosed in % percent signs):

ATTACHURL -- attachment URL of 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

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

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

SCRIPTURL -- script URL of JCuckoo

SCRIPTURLPATH -- script URL path of JCuckoo

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

Preferences Variables

Additional variables are defined in the preferences ( site-level ( SL ) in TWikiPreferences, web-level ( WL ) in WebPreferences of each web, and user level ( UL ) preferences in individual user topics):

Variable: Level: What:
%ALLOWTOPICCHANGE% (any topic) List of users and groups who are allowed to change the current topic. (More in TWikiAccessControl)
%ALLOWTOPICRENAME% (any topic) List of users and groups who are allowed to rename the current topic. (More in TWikiAccessControl)
%ALLOWWEBCHANGE% WL List of users and groups who are allowed to change topics in the JCuckoo web. (More in TWikiAccessControl)
%ALLOWWEBRENAME% WL List of users and groups who are allowed to rename topics in the JCuckoo web. (More in TWikiAccessControl)
%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)
%DENYTOPICRENAME% (any topic) List of users and groups who are not allowed to rename the current topic. (More in TWikiAccessControl)
%DENYWEBCHANGE% WL List of users and groups who are not allowed to change topics in the JCuckoo web. (More in TWikiAccessControl)
%DENYWEBRENAME% WL List of users and groups who are not allowed to rename topics in the JCuckoo 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:
%EDITBOXHEIGHT% SL , UL Vertical size of edit box, is 50
%EDITBOXWIDTH% SL , UL Horizontal size of edit box, is 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%
%FINALPREFERENCES% SL , WL List of preferences that are not allowed to be overridden by next level preferences
%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 )
%NEWTOPICFONTCOLOR% SL , UL Font color of non existing topic. ( UL needs authentication for topic views )
%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
%WEBCOPYRIGHT% SL , WL Copyright notice (bottom right corner of topics)
%WEBTOPICLIST% WL Common links of web (second line of topics)
%WIKIWEBLIST% SL List of JCuckoo webs (in upper right corner of topics)
%WIKIWEBMASTER% SL Webmaster email address (sender of email notifications) , is rumcajs_78@users.sourceforge.net

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:Main.PeterThoeny - 09 May 2004
-- TWiki:Main.MikeMannix - 12 May 2002