%TOC% %STARTINCLUDE% ---# 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:__ * To leave a variable unexpanded, precede it with an exclamation point, e.g. type =!%TOPIC%= to get !%TOPIC%. * Variables are expanded relative to the topic they are _used_ in, not the topic they are _defined_ in. ---++ 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. * %T% *Take the time to thoroughly read through ALL preference variables.* If you actively configure your site, review variables periodically. They cover a wide range of functions, and it can be easy to miss the one perfect variable for something you have in mind. For example, see ==%INCLUDINGTOPIC%==, ==%INCLUDE%==, and the mighty ==%SEARCH%==. This version of TWiki - %WIKIVERSION% - expands the following variables (enclosed in ==%== percent signs): %INCLUDE{"TWikiVariablesAtoM"}% %INCLUDE{"TWikiVariablesNtoZ"}% __Note:__ Above text is included from TWikiVariablesAtoM and TWikiVariablesNtoZ #PreferencesVariables ---++ Preferences Variables Additional variables are defined in the preferences topics: * site-level ( __SL__ ) in %TWIKIWEB%.%WIKIPREFSTOPIC% * web-level ( __WL__ ) in %WEBPREFSTOPIC% of each web * user level ( __UL__ ) in individual user 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) %ALLOWTOPICCHANGE%  
=%ALLOWTOPICRENAME%= __(any topic)__ List of users and groups who are *allowed* to rename the current topic. (More in TWikiAccessControl) %ALLOWTOPICRENAME%  
=%ALLOWWEBCHANGE%= __WL__ List of users and groups who are *allowed* to change topics in the %WIKITOOLNAME% web. (More in TWikiAccessControl) %ALLOWWEBCHANGE%  
=%ALLOWWEBRENAME%= __WL__ List of users and groups who are *allowed* to rename topics in the %WIKITOOLNAME% web. (More in TWikiAccessControl) %ALLOWWEBRENAME%  
=%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: %ATTACHLINKBOX% %ATTACHLINKBOX%  
=%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 %WIKITOOLNAME% web. (More in TWikiAccessControl) %DENYWEBCHANGE%  
=%DENYWEBRENAME%= __WL__ List of users and groups who are *not allowed* to rename topics in the %WIKITOOLNAME% web. (More in TWikiAccessControl) %DENYWEBRENAME%  
=%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: %DONTNOTIFYCHECKBOX% %DONTNOTIFYCHECKBOX%  
=%EDITBOXHEIGHT%= __SL__ , __UL__ Vertical size of edit box, is =%EDITBOXHEIGHT%= %EDITBOXHEIGHT%  
=%EDITBOXWIDTH%= __SL__ , __UL__ Horizontal size of edit box, is =%EDITBOXWIDTH%= %EDITBOXWIDTH%  
=%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: %EDITBOXSTYLE% %EDITBOXSTYLE%  
=%FINALPREFERENCES%= __SL__ , __WL__ List of preferences that are not allowed to be overridden by next level preferences %FINALPREFERENCES%  
=%HTTP_EQUIV_ON_EDIT%= __SL__ , __UL__ http-equiv meta tags for edit script. %HTTP_EQUIV_ON_EDIT%  
=%HTTP_EQUIV_ON_PREVIEW%= __SL__ , __UL__ http-equiv meta tags for preview script. %HTTP_EQUIV_ON_PREVIEW%  
=%HTTP_EQUIV_ON_VIEW%= __SL__ http-equiv meta tags for view, rdiff, attach, search* scripts. %HTTP_EQUIV_ON_VIEW%  
=%NEWTOPICBGCOLOR%= __SL__ , _UL_ Background color of non existing topic. ( __UL__ needs authentication for topic views ) %NEWTOPICBGCOLOR%  
=%NEWTOPICFONTCOLOR%= __SL__ , _UL_ Font color of non existing topic. ( __UL__ needs authentication for topic views ) %NEWTOPICFONTCOLOR%  
=%NOSEARCHALL%= __WL__ Exclude web from a =web="all"= search (set variable to =on= for hidden webs) %NOSEARCHALL%  
=%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: %RELEASEEDITLOCKCHECKBOX% %RELEASEEDITLOCKCHECKBOX%  
=%WEBBGCOLOR%= __WL__ Background color of web %WEBBGCOLOR%  
=%WEBCOPYRIGHT%= __SL__ , __WL__ Copyright notice (bottom right corner of topics) %WEBCOPYRIGHT%  
=%WEBTOPICLIST%= __WL__ Common links of web (second line of topics) %WEBTOPICLIST%  
=%WIKIWEBLIST%= __SL__ List of %WIKITOOLNAME% webs (in upper right corner of topics) %WIKIWEBLIST%  
=%WIKIWEBMASTER%= __SL__ Webmaster email address (sender of email notifications) , is %WIKIWEBMASTER% %WIKIWEBMASTER%  
__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 %H% Help icon. #SettingPrefs ---++ Setting Preferences * The syntax for Preferences 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] = [value]
__Examples:__ * ==Set VARIABLENAME = value== * ==Set VARIABLENAME = value== ---++ Creating Custom Variables * You can add your own Preference Variables for us across an entire site or a single web, using the standard [[#SettingPrefs][Preferences syntax]]. Whatever you include in your Variable will be expanded on display, exactly as if it had been entered directly. You can place formatted text, page links, image paths.
*Example: Create a custom logo variable the %WEB% web*
* To place a logo anywhere in a web by typing ==%MYLOGO%==, define the Variable on the web's WebPreferences page, and upload a logo file, ex: =mylogo.gif=. You can upload by [[FileAttachment][attaching the file]] to WebPreferences, or, to avoid clutter, to any other topic in the same web, ex: =LogoTopic=: * ==Set MYLOGO = %PUBURL%/TWiki/LogoTopic/mylogo.gif==
-- TWiki:Main.PeterThoeny - 14 Aug 2004
-- TWiki:Main.MikeMannix - 12 May 2002 %STOPINCLUDE% Crawford split up this topic into included TWikiVariablesAtoM and TWikiVariablesNtoZ. -- Main.PeterThoeny - 26 Jul 2004