Difference: SystemInformationVariables ( vs. 1)

Revision 12012-11-11 - TWikiContributor

Line: 1 to 1
Added:
>
>
META TOPICPARENT name="TWikiVariablesSearch"

TWiki Variables » Search » Category: System Information

Variables in this category:

BASETOPIC -- base topic where an INCLUDE started

  • The name of the topic where a single or nested INCLUDE started - same as %TOPIC% if there is no INCLUDE.
  • Syntax: %BASETOPIC%
  • Example: If topic A includes B, and B includes C, then a %BASETOPIC% in topic C is reported as A when looking at topic A, B when looking at topic B, and C when looking at topic C itself.
  • Category: SystemInformationVariables
  • Related: BASEWEB, INCLUDINGTOPIC, INCLUDE, TOPIC (this topic)

BASEWEB -- base web where an INCLUDE started

  • The web name where the includes started, e.g. the web of the first topic of nested includes. Same as %WEB% in case there is no include.
  • Syntax: %BASEWEB%
  • Syntax: %BASEWEB{format="..."}% -- see WEB for format documentation
  • Example: If topic A includes B, and B includes C, then a %BASEWEB% in topic C is reported as the web of topic A when looking at topic A, the web of topic B when looking at topic B, and the web of topic C when looking at topic C itself.
  • Category: SystemInformationVariables
  • Related: BASETOPIC, INCLUDINGWEB, INCLUDE, WEB (this topic)

CHILDREN -- find children of a topic

CONTENTMODE{web="WEB"} -- content mode

DATE -- signature format date

DISPLAYTIME -- display date and time

DISPLAYTIME{"format"} -- formatted display time

ENV{"varname"} -- inspect the value of an environment variable

  • Returns the current value of the environment variable in the CGI (Common Gateway Interface) environment. This is the environment that the TWiki scripts run in on the web server.
  • Note: For security reasons, only those variables whose names match the regular expression in {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.
  • Example: %ENV{MOD_PERL}% displays as: not set
  • If a variable is undefined (as against being set to the empty string) it will be returned as not set.
  • Category: SystemInformationVariables
  • Related: HTTP_HOST, REMOTE_ADDR, REMOTE_PORT, REMOTE_USER (this topic)

FAILEDPLUGINS -- debugging for plugins that failed to load, and handler list

HOMETOPIC -- home topic in each web

HTTP -- get HTTP headers

HTTP_HOST -- environment variable

HTTPS -- get HTTPS headers

  • The same as %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.
  • Syntax: %HTTPS%
  • Syntax: %HTTPS{"Header-name"}%
  • Limitation: For security reasons, the COOKIE field value cannot be retrieved. You can add or delete hidden fields by changing the {HTTP}{HiddenFields} configuration parameter.
  • Category: SystemInformationVariables
  • Related: HTTP, REMOTE_ADDR, REMOTE_PORT, REMOTE_USER (this topic)

INCLUDINGTOPIC -- name of topic that includes current topic

  • The name of the topic that includes the current topic - same as %TOPIC% in case there is no include.
  • Syntax: %INCLUDINGTOPIC%
  • Example: If topic A includes B, and B includes C, then a %INCLUDINGTOPIC% in topic C is reported as B when looking at topics A or B, and as C when looking at topic C itself.
  • Category: SystemInformationVariables
  • Related: BASETOPIC, INCLUDINGWEB, INCLUDE, TOPIC (this topic)

INCLUDINGWEB -- web that includes current topic

  • The web name of the topic that includes the current topic - same as %WEB% if there is no INCLUDE.
  • Syntax: %INCLUDINGWEB%
  • Syntax: %INCLUDINGWEB{format="..."}% -- see WEB for format documentation
  • Example: If topic A includes B, and B includes C, then a %INCLUDINGWEB% in topic C is reported as web of topic B when looking at topics A or B, and as of topic C when looking at topic C itself.
  • Category: SystemInformationVariables
  • Related: BASEWEB, INCLUDINGTOPIC, INCLUDE, WEB (this topic)

LANGUAGE -- current user's language

  • Returns the language code for the language used as the current user. This is the language actually used by TWiki Internationalization (e.g. in user interface).
  • The language is detected from the user's browser, unless some site/web/user/session-defined setting overrides it:
    • If the LANGUAGE preference is set, it's used as user's language instead of any language detected from the browser.
    • Avoid defining LANGUAGE at a non per-user way, so each user can choose his/her preferred language.
  • Category: AdministrationVariables, SystemInformationVariables
  • Related: LANGUAGES (this topic)

LANGUAGES -- list available TWiki languages

  • List the languages available (as PO files) to TWiki. Those are the languages in which TWiki's user interface is available.
  • Syntax: %LANGUAGES{...}%
  • Supported parameters:
    Parameter: Description: Default:
    format format for each item. See below for variables available in the format string. "   * $langname"
    separator separator between items. "\n" (newline)
    marker="selected" Text for $marker if the item matches selection "selected"
    selection="%LANGUAGE%" Current language to be selected in list (none)
  • format variables:
    Variable Meaning
    $langname language's name, as informed by the translators
    $langtag language's tag. Ex: en, pt-br, etc.
  • Category: AdministrationVariables, SystemInformationVariables
  • Example: <select>%LANGUAGES{format="<option $marker value='$langtag'>$langname</option>" selection="%LANGUAGE%"}%</select> creates an option list of the available languages with the current language selected (this topic)

LOCALSITEPREFS -- web.topicname of site preferences topic

MAINWEB -- synonym for USERSWEB

MDREPO -- retrieve data from metadata repository

  • Attention: This variable works only if MetadataRepository is in use. Otherwise, it always returns a zero length string.
  • This retrieves data from the specified metadata repository table.
  • Syntax: %MDREPO{ "table" ...}% (generic form), %MDREPO{ web="..." ...}% (web specific form)
  • Parameters (generic form without web="..." parameter):
    Parameter Description Default
    "..." Specify the table to retrieve This or below is required
    table="..." (Alternative to above) This or above is required
    separator="..." The separator string of records "$n" (new line)
    format="..." Format of one record. It may contain the following items. In addtion, the standard special tokens are handled accordingly.
    Item Description
    $_ or $_() the record ID
    $__ or $__() The record value in the following format:
    FIELD_NAME=FIELD_VALUE FIELD_NAME=FIELD_VALUE ...
    $marker or $marker() Expands to marker for the item matching selection only
    $_FILED_NAME or $_FIELD_NAME() Please be noted that you need to put _ (underscore) in front of a field name. $_FIELD_NAME$ yields the value of the specified field. If the specified field does not exist in the record, it returns the null string ("").
    ?FIELD_NAME?IF_FIELD_HAS_VALUE? If the specified field has value and it's neither 0 nor the null string (""), it's evaluated as IF_FIELD_HAS_VALUE. Otherwise, it's evaluated as the null string. This is like q/.../ in Perl. A non-word character following ?FIELD_NAME becomes the terminator; i.e. you can write: ?FIELD_NAME:IF_TRUE:
    Specifically, the following characters can be used as the delimiter: ! # % ' / : ? @ ^ ` | ~
    = is excluded because it clashes with a parameter specification in a URL (?name=value).
    ?!FIELD_NAME?IF_FIELD_HAS_NO_VALUE? Similar to above but it's opposite. If the field has value, it's evaluated as the null string. Otherwise, it's evaluated as IF_FIELD_HAS_NO_VALUE.
    $question Replaced with ? after the ?FIEL_DNAME and ?!FIELD_ANME constructs are processed.
    "| $_ | $__ |"
    selection="..." The record ID to be regarded as the selected. It affects how $marker in the format is evaluated. none
    marker="..." Text for $marker in the format if the item matches selection "selected"
    filter="..." The regular expression of record IDs to filter records. Matching is case-insensitive none
    exclude="..." Comma separated list of record IDs to be excluded. You can use regular expression. If you specify Trash\d*, then Trash, Trash1, Trash2, ... are exluded but LightTrash and TrashBag are not excluded none
  • Example: %MDREPO{"webs" filter="^A" format="| $_ | $_admin | $_master |"}%
    This would show the metadata of webs whose names start with A.
  • Paramerers (web specific form):
    Parameter Description Default
    web="..." Specify the web. If it's a subweb, the corresponding top level web is specified This is required
    "..." Specify the format of the return value in the same manner as the format parameter in the generic form $__
    default="..." Specify the value to be returned when the specified or implied top level web does not exist in MDREPO "" (null string)
  • Example: %MDREPO{web="Foo/Bar" "$_admin"}%
    This would show the admin field of the Foo web.
  • Category: AdministrationVariables, SystemInformationVariables
  • Related: MetadataRepository (this topic)

META -- displays meta-data

  • Provided mainly for use in templates, this variable generates the parts of the topic view that relate to meta-data (attachments, forms etc.) The formfield item is the most likely to be useful to casual users.
  • Syntax: %META{ "item" ...}%
  • Parameters:
    Item Options Description
    "formfield" name="...": name of the field. The field value can be shortened as described in FormattedSearch for $formfield.
    newline="...": by default, each newline character will be rewritten to <br /> to allow metadata that contains newlines to be used in tables, etc. $n indicates a newline character.
    bar="...": by default, each vertical bar is rewritten to an HTML entity so as to not be mistaken for a table separator.
    encode="type": have the value encoded in the specified type. Possible types are the same as ENCODE's. If this is specified, newline and bar options are ignored.
    topic="...": Get meta info of "Topic" or "Web.Topic"; default "%BASEWEB%.%BASETOPIC%".
    Show a single form field
    "form" topic="...": Get meta info of "Topic" or "Web.Topic"; default "%BASEWEB%.%BASETOPIC%". Generates the table showing the form fields. See Form Templates
    "attachments" all="on" to show hidden attachments.
    title="..." to show a title - only if attachments are displayed.
    template="..." to use a custom template for the rendering of attachments; default attachtables is used.
    topic="...": Get meta info of "Topic" or "Web.Topic"; default "%BASEWEB%.%BASETOPIC%".
    Generates the list of attachments
    "moved" topic="...": Get meta info of "Topic" or "Web.Topic"; default "%BASEWEB%.%BASETOPIC%". Details of any topic moves
    "parent" dontrecurse="on": By default recurses up tree, this has some cost.
    nowebhome="on": Suppress WebHome.
    prefix="...": Prefix that goes before parents, but only if there are parents, default "".
    format="...": Format string used to display each parent topic where $web expands to the web name, and $topic expands to the topic name; default: "[[$web.$topic][$topic]]"
    suffix="...": Suffix, only appears if there are parents; default "".
    separator="...": Separator between parents; default " > ".
    topic="...": Get meta info of "Topic" or "Web.Topic"; default "%BASEWEB%.%BASETOPIC%".
    Generates the parent link
  • Attention: The base topic, not the current topic, is used if %META{}% is placed in an included topic. Add a topic="%WEB%.%TOPIC%" parameter if you need meta info of the current topic.
  • Note: Formatting tokens can be used for newline, prefix, format, suffix and separator options, such as separator="$n   * "
  • Category: AttachmentsAndFilesVariables, SearchingAndListingVariables, SystemInformationVariables
  • Related: EDITFORMFIELD, FORMFIELD, METASEARCH, PARENTTOPIC, SEARCH, ENCODE, FormattedSearch (this topic)

METASEARCH -- special search of meta data

  • Syntax: %METASEARCH{...}%
  • Supported parameters:
    Parameter: Description: Default:
    type="..." Type of search:
    "topicmoved" - search for a topic that may have been moved.
    "parent" - search for topics that have a specific parent i.e. its children.
    "field" - search for topics that have a particular form field value (use the name and value parameters to specify which field to search).
    Required
    web="%WEB%" Wiki web to search: A web, a list of webs separated by whitespace, or all webs. Current web
    topic="%TOPIC%" The topic the search relates to. Current topic
    name="..." form field to search, for type="field" searches. May be a regular expression (see SEARCH).  
    value="..." form field value, for type="field" searches. May be a regular expression (see SEARCH).  
    title="Title" Text that is prefixed to any search results. "" (empty)
    format="..." Custom format of each search hit. Supports same format strings as SEARCH. See FormattedSearch for usage, variables & examples "$topic"
    separator="..." Separator between search hits. "$n" (newline)
    default="none" Default text shown if no search hit. "" (empty)
  • Example: %METASEARCH{type="topicmoved" web="%WEB%" topic="%TOPIC%" title="This topic used to exist and was moved to: "}%
  • Example: You may want to use this in WebTopicViewTemplate and WebTopicNonWikiTemplate:
    %METASEARCH{type="parent" web="%WEB%" topic="%TOPIC%" title="Children: "}%
  • Example: %METASEARCH{type="field" name="Country" value="China"}%
  • Note: METASEARCH is deprecated in favor of the much more powerful query type search. See SEARCH and QuerySearch.
  • Category: SearchingAndListingVariables, SystemInformationVariables
  • Related: CHILDREN, EDITFORM, EDITFORMFIELD, FORM, FORMFIELD, META, PARENTTOPIC, SEARCH (this topic)

NOTIFYTOPIC -- name of the notify topic

PARENTTOPIC -- parent of current topic

PLUGINDESCRIPTIONS -- list of plugin descriptions

  • Syntax: %PLUGINDESCRIPTIONS%
  • Expands to:
    • SpreadSheetPlugin (2015-06-07, $Rev: 29570 (2015-11-29) $): Add spreadsheet calculation like "$SUM( $ABOVE() )" to TWiki tables or anywhere in topic text
    • BackupRestorePlugin (2015-01-09, $Rev: 28636 (2015-11-29) $): Administrator utility to backup, restore and upgrade a TWiki site
    • ColorPickerPlugin (2015-01-10, $Rev: 29507 (2015-11-29) $): Color picker, packaged for use in TWiki forms and TWiki applications
    • CommentPlugin (2015-01-10, $Rev: 28648 (2015-11-29) $): Quickly post comments to a page without an edit/preview/save cycle
    • DatePickerPlugin (2015-01-10, $Rev: 29510 (2015-11-29) $): Pop-up calendar with date picker, for use in TWiki forms, HTML forms and TWiki plugins
    • EditTablePlugin (2015-01-10, $Rev: 29516 (2015-11-29) $): Edit TWiki tables using edit fields, date pickers and drop down boxes
    • HeadlinesPlugin (2015-11-06, $Rev: 29650 (2015-11-29) $): Show headline news in TWiki pages based on RSS and ATOM news feeds from external sites
    • HttpsRedirectPlugin (2011-01-21, $Rev: 20293 (2011-01-21) $): Redirect authenticated users to HTTPS url.
    • InterwikiPlugin (2015-06-18, $Rev: 29526 (2015-11-29) $): Write ExternalSite:Page to link to a page on an external site based on aliases defined in a rules topic
    • JQueryPlugin (2015-01-10, $Rev: 29532 (2015-11-29) $): jQuery JavaScript library for TWiki
    • LaTeXToMathMLPlugin (2011-03-17, $Rev: 20767 (2011-03-17) $): Display LaTeX-like equations in-line using MathML
    • LatexModePlugin (3.71, $Rev: 16926 (12 Dec 2008) $): Enables LaTeX markup (mathematics and more) in TWiki topics
    • PreferencesPlugin (2015-01-14, $Rev: 29550 (2015-11-29) $): Allows editing of preferences using fields predefined in a form
    • SetGetPlugin (2015-07-09, $Rev: 29564 (2015-11-29) $): Set and get variables and JSON objects in topics, optionally persistently across topic views
    • SlideShowPlugin (2015-01-14, $Rev: 29566 (2015-11-29) $): Create web based presentations based on topics with headings.
    • SmiliesPlugin (2015-02-16, $Rev: 29568 (2015-11-29) $): Render smilies as icons, like  :-)  as smile or  :eek:  as eek!
    • TablePlugin (2015-02-16, $Rev: 29580 (2015-11-29) $): Control attributes of tables and sorting of table columns
    • TagMePlugin (2015-02-16, $Rev: 29582 (2015-11-29) $): Tag wiki content collectively or authoritatively to find content by keywords
    • TinyMCEPlugin (2015-02-16, $Rev: 29584 (2015-11-29) $): Integration of the Tiny MCE WYSIWYG Editor
    • TwistyPlugin (2015-04-28, $Rev: 29600 (2015-11-29) $): Twisty section JavaScript library to open/close content dynamically
    • WatchlistPlugin (2015-01-15, $Rev: 28820 (2015-11-29) $): Watch topics of interest and get notified of changes by e-mail
    • WysiwygPlugin (2015-02-16, $Rev: 29604 (2015-11-29) $): Translator framework for WYSIWYG editors
  • Category: AdministrationVariables, SystemInformationVariables
  • Related: ACTIVATEDPLUGINS, FAILEDPLUGINS, PLUGINVERSION, TWikiPlugins, InstalledPlugins (this topic)

PLUGINVERSION -- the version of a TWiki Plugin, or the TWiki Plugins API

PUBURL -- the base URL of attachments

PUBURLPATH -- the base URL path of attachments

QUERYPARAMS -- show paramaters to the query

  • Expands the parameters to the query that was used to display the page.
  • Syntax: %QUERYPARAMS{...}%
  • Parameters:
    • format="..." format string for each entry, default $name=$value
    • separator="..." separator string, default separator="$n" (newline)
    • encode="..." the encoding to apply to parameter values; see ENCODE for a description of the available encodings. If this parameter is not given, no encoding is performed.
      <-- Note: encoding="..." works too but has been deprecated in Item6621 -->
  • The following escape sequences are expanded in the format string:
    Sequence: Expands To:
    $name Name of the parameter
    $value String value of the parameter. Multi-valued parameters will have a "row" for each value.
    $n or $n() New line. Use $n() if followed by alphanumeric character, e.g. write Foo$n()Bar instead of Foo$nBar
    $nop or $nop() Is a "no operation". This variable gets removed; useful for nested search
    $quot or \" Double quote (")
    $aquot Apostrophe quote (')
    $percnt Percent sign (%)
    $dollar Dollar sign ($)
    $lt Less than sign (<)
    $gt Greater than sign (>)

QUERYSTRING -- full, unprocessed string of parameters to this URL

  • String of all the URL parameters that were on the URL used to get to the current page. For example, if you add ?name=Samantha;age=24;eyes=blue to this URL you can see this in action. This string can be appended to a URL to pass parameter values on to another page.
  • ALERT! Note: URLs built this way are typically restricted in length, typically to 2048 characters. If you need more space than this, you will need to use an HTML form and %QUERYPARAMS%.
  • Syntax: %QUERYSTRING%
  • Expands to: sortcol=1;table=3;up=0
  • Category: DevelopmentVariables, SystemInformationVariables
  • Related: QUERYPARAMS, URLPARAM (this topic)

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

  • Syntax: %REVINFO{"format"}%
  • Supported parameters:
    Parameter: Description: Default:
    "format" Format of revision information, see supported variables below "r$rev - $date - $time - $wikiusername"
    web="..." Name of web Current web
    topic="..." Topic name Current topic
    rev="5" Specific revison number. Old RCS format "1.5" is also supported. Latest revision
  • Supported variables in format:
    Variable: Unit: Example
    $web Name of web Current web
    $topic Topic name Current topic
    $rev Revison number. Add prefix r to get the usual r5 format 5
    $username Login username of revision jsmith
    $wikiname WikiName of revision JohnSmith
    $wikiusername WikiName with Main web prefix Main.JohnSmith
    $date Revision date. Actual date format defined as {DefaultDateFormat} in configure, default $year-$mo-$day 2010-12-31
    $time Revision time 23:24:25
    $iso Revision date in ISO date format 2006-09-22T06:24:25Z
    $min, $sec, etc. Same date format qualifiers as GMTIME{"format"}  
  • Example: %REVINFO{"$date - $wikiusername" rev="1.1"}% returns revision info of first revision
  • Category: SystemInformationVariables
  • Related: GMTIME{"format"}, REVINFO (this topic)

SCRIPTNAME -- name of current script

SCRIPTSUFFIX -- script suffix

SCRIPTURL -- base URL of TWiki scripts

SCRIPTURL{"script"} -- URL of TWiki script

  • Expands to the URL of the specified script. Optionally, you can specify a web and/or a topic. In that case, the URL of the script for the specified web and topic is returned.
  • If ReadOnlyAndMirrorWebs is in effect and a web is specified, whether the web is a slave or not is taken into account. For a slave web, with scripts edit, save, attach, upload, and rename, the URL on the master site is returned.
    For the other scripts, if the master="on" parameter is specified, the URL on the master site is returned.
  • Syntax: %SCRIPTURL{"script" ...}%
  • Supported parameters:
    Parameter: Description: Default:
    "script" The name of the script  
    web="WEB" Specifies a web When a topic name is specified and a web is not, the current web is assumed
    topic="TOPIC" or topic="WEB.TOPIC" Specifies a topic or both a web and a topic  
    master="on" A URL on the master site is needed or not off
  • If web="WEB" is specified but topic is not specified, the resulting URL ends with WEB.
  • Example: To get the authenticated version of the current topic you can write %SCRIPTURL{"viewauth"}%/%WEB%/%TOPIC% which expands to https://twiki.ace.fordham.edu/bin/viewauth/TWiki/TWikiVariablesCategoryBody. It can be written %SCRIPTURL{"viewauth" topic="%TOPIC%"}% as well.
  • Example: Let's assume this site has a web named 'Flowers' whose master site is http://florawiki/cgi-bin. Then %SCRIPTURL{"edit" web="Flowers"}% expands to http://florawiki/cgi-bin/edit/Flowers. This is because the 'Flower' web on this site is a slave and editing needs to happen on the master site.
  • Example: Asuming above, %SCRIPTURL{"view" web="Flowers" master="on"}% expands to http://florawiki/cgi-bin/view/Flowers. The view script works on a slave site, but master="on" parameter forces to yield the master site URL.
  • Example: How to link to another topic with a URL parameter: [[%SCRIPTURL{view}%/%WEB%/MyQuery?food=sushi][Sushi]]
  • Note: In most cases you should use %SCRIPTURLPATH{"script"}% instead, as it works with URL rewriting much better
  • Category: DevelopmentVariables, SystemInformationVariables
  • Related: CONTENTMODE, PUBURL, SCRIPTNAME, SCRIPTSUFFIX, SCRIPTURL, SCRIPTURLPATH, SCRIPTURLPATH{"script"}, SITENAME, ReadOnlyAndMirrorWebs, MetadataRepository, TWikiScripts (this topic)

SCRIPTURLPATH -- base URL path of TWiki scripts

SCRIPTURLPATH{"script"} -- URL path of TWiki script

  • As %SCRIPTURL{"script"}%, but doesn't include the protocol and host part of the URL
  • Like %SCRIPTURL{"script"}%, this variable is aware of ReadOnlyAndMirrorWebs. So it may return a URL of a different site.
  • Syntax: %SCRIPTURLPATH{"script" ...}%
  • Supported parameters:
    Parameter: Description: Default:
    "script" The name of the script.  
    web="WEB" Specifies a web When a topic name is specified and a web is not, the current web is assumed
    topic="TOPIC" or topic="WEB.TOPIC" Specifies a topic or both a web and a topic  
    master="on" A URL on the master site is needed or not. off
  • If web="WEB" is specified but topic is not specified, the resulting URL ends with WEB.
  • Example: %SCRIPTURLPATH{"view"}% expands to "/bin/view" (This might be a null string. Hence surrounded by double quotes)
  • Example: %SCRIPTURLPATH{"view" web="%WEB%"}% expands to /bin/view/TWiki
  • Example: %SCRIPTURLPATH{"view" topic="%TOPIC%"}% expands to /bin/view/TWiki/VarSCRIPTURLPATH2
  • Example: Let's assume this site has a web named 'Flowers' whose master site is http://florawiki/cgi-bin. Then %SCRIPTURLPATH{"edit" web="Flowers"}% expands to http://florawiki/cgi-bin/edit/Flowers. This is because the 'Flower' web on this site is a slave and editing needs to happen on the master site.
  • Category: DevelopmentVariables, SystemInformationVariables
  • Related: CONTENTMODE, PUBURLPATH, SCRIPTNAME, SCRIPTSUFFIX, SCRIPTURL, SCRIPTURL{"script"}, SCRIPTURLPATH, ReadOnlyAndMirrorWebs, MetadataRepository, TWikiScripts (this topic)

SERVERTIME -- server time

SERVERTIME{"format"} -- formatted server time

SESSIONID -- unique ID for this session

SESSIONVAR -- name of CGI and session variable that stores the session ID

SESSION_VARIABLE -- get, set or clear a session variable

  • Session variables are stored in a personal "persistent memory space" that is not lost until the web browser is closed
  • Syntax: %SESSION_VARIABLE{"name"}% - read a session variable
  • Syntax: %SESSION_VARIABLE{"name" set="value"}% - set a session variable
  • Syntax: %SESSION_VARIABLE{"name" clear=""}% - clear a session variable
  • Special read-only session variables:
    • %SESSION_VARIABLE{"AUTHUSER"}% - user ID, current value:
    • %SESSION_VARIABLE{"SESSION_REQUEST_NUMBER"}% - number of pages accessed by current user since login, current value:
  • Note: It is not possible to set/get/clear session variables starting with an underscore, such as "_NON_OF_YOUR_BUSINESS"
  • Category: DevelopmentVariables, SystemInformationVariables, UsersAndAuthenticationVariables
  • Related: TWikiUserAuthentication#Sessions, AUTHREALM, GET, LOGIN, LOGOUT, SESSIONID, SESSIONVAR, SET (this topic)

SITENAME -- the current site name

SITESTATISTICSTOPIC -- name of site statistics topic

STATISTICSTOPIC -- name of statistics topic

SYSTEMWEB -- name of TWiki documentation web

TOPIC -- name of current topic

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

  • List of all topics in a web. The "format" defines the format of one topic item. It may include variables: The $topic variable gets expanded to the topic name, $marker to marker parameter where topic matches selection, and $web to the name of the web, or any of the standard FormatTokens.
  • Syntax: %TOPICLIST{"format" ...}%
  • Supported parameters:
    Parameter: Description: Default:
    "format" Format of one line, may include $web (name of web), $topic (name of the topic), $marker (which expands to marker for the item matching selection only) "$topic"
    format="format" (Alternative to above) "$topic"
    separator=", " line separator "$n" (new line)
    marker="selected" Text for $marker if the item matches selection "selected"
    selection="TopicA, TopicB" Current value to be selected in list (none)
    web="Name" Name of web Current web
  • Example: %TOPICLIST{"   * $web.$topic"}% creates a bullet list of all topics
  • Example: %TOPICLIST{separator=", "}% creates a comma separated list of all topics
  • Example: %TOPICLIST{" <option>$topic</option>"}% creates an option list (for drop down menus)
  • Example: <select>%TOPICLIST{" <option $marker value='$topic'>$topic</option>" separator=" " selection="%TOPIC%"}%</select> creates an option list of web topics with the current topic selected
  • Category: SearchingAndListingVariables, SystemInformationVariables
  • Related: SEARCH, WEBLIST (this topic)

TOPICTITLE -- title of a topic

  • The topic title is defined by, in order of sequence:
    • form field named "Title",
    • topic preference setting named TITLE,
    • topic name.
  • Syntax: %TOPICTITLE% or %TOPICTITLE{ topic="TopicName" }%
  • Supported parameters:
    Parameter: Description: Default:
    "..." or
    topic="..."
    Topic to get the title from. Can be of form TopicName or Web.TopicName. Current topic
    encode="html" Encode special characters into HTML entities. If a TOPICTITLE is passed into an HTML form field it should be encoded as "html". Additional encodings: encode="quote", encode="moderate", encode="safe", encode="entity" and encode="url". See ENCODE for details. "" (no encoding)
  • Example: %TOPICTITLE{Projects.SushiProject}% returns Sushi Project assuming the topic has a form field named "Title" with value "Sushi Project"
  • Expands to: TWikiVariablesCategoryBody
  • Category: SystemInformationVariables
  • Related: BASETOPIC, INCLUDINGTOPIC, PARENTTOPIC, TOPIC, TOPICLIST, TOPICURL, WEB (this topic)

TOPICURL -- shortcut to viewing the current topic

TWIKIWEB -- synonym for SYSTEMWEB

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

  • Returns the value of a URL parameter.
  • Syntax: %URLPARAM{"name"}%
  • Supported parameters:
    Parameter: Description: Default:
    "name" The name of a URL parameter required
    newline="$br" Convert newlines in textarea to other delimiters. Variables $br (for <br /> tag), $n (for newline) are expanded. Other text is encoded based on encode parameter. no conversion
    encode="off" Turn off encoding. See important security note below encode="safe"
    encode="quote" Escape double quotes with backslashes (\"), does not change other characters; required when feeding URL parameters into other TWiki variables. This encoding does not protect against cross-site scripting. encode="safe"
    encode="moderate" Encode special characters into HTML entities for moderate cross-site scripting protection: "<", ">", single quote (') and double quote (") are encoded. Useful to allow TWiki variables in comment boxes. encode="safe"
    encode="safe" Encode special characters into HTML entities for cross-site scripting protection: "<", ">", "%", single quote (') and double quote (") are encoded. (this is the default)
    encode="entity" Encode special characters into HTML entities. See ENCODE for details. encode="safe"
    encode="html" Encode special characters into HTML entities. In addition to encode="entity", it also encodes space, newline (\n) and linefeed (\r). Useful to encode text properly in HTML input fields. encode="safe"
    encode="url" Encode special characters for URL parameter use, like a double quote into %22 encode="safe"
    multiple="on"
    multiple="[[$item]]"
    If set, gets all selected elements of a <select multiple="multiple"> tag. A format can be specified, with $item indicating the element, e.g. multiple="Option: $item" first element
    separator=", " Separator between multiple selections. Only relevant if multiple is specified "\n" (newline)
    format="..." Format the result. $value expands to the URL parameter. If multiple is specified, $value expands to the result of the concatenated items. "$value"
    default="..." Default value in case parameter is empty or missing. The format parameter is not applied. empty string
  • Example: %URLPARAM{"skin"}% returns print for a .../view/TWiki/TWikiVariablesCategoryBody?skin=print URL
  • ALERT! Notes:
    • IMPORTANT: There is a risk that this variable can be misused for cross-site scripting (XSS) if the encoding is turned off. The encode="safe" is the default, it provides a safe middle ground. The encode="entity" is more aggressive, but some TWiki applications might not work.
    • URL parameters passed into HTML form fields should be encoded as "html".
      Example: <input type="text" name="address" value="%URLPARAM{ "address" encode="html" }%" />
    • Double quotes in URL parameters must be escaped when passed into other TWiki variables.
      Example: %SEARCH{ "%URLPARAM{ "search" encode="quotes" }%" noheader="on" }%
    • When used in a template topic, this variable will be expanded when the template is used to create a new topic. See TWikiTemplates#TemplateTopicsVars for details.
    • Watch out for TWiki internal parameters, such as rev, skin, template, topic, web; they have a special meaning in TWiki. Common parameters and view script specific parameters are documented at TWikiScripts.
    • If you have %URLPARAM{ in the value of a URL parameter, it will be modified to %<nop>URLPARAM{. This is to prevent an infinite loop during expansion.
  • Category: DevelopmentVariables, SystemInformationVariables
  • Related: ENCODE, ENTITY, SEARCH, FormattedSearch, QUERYSTRING (this topic)

USERINFO{"name"} -- retrieve details about a user

  • Syntax: %USERINFO%
  • Expands to: guest, TWikiGuest, (comma-separated list of the username, wikiusername, and emails)
  • With formatted output, using tokens $emails, $username, $wikiname, $wikiusername, $groups and $admin ($admin returns 'true' or 'false'):
    • Example: %USERINFO{ format="$username is really $wikiname" }%
    • Expands to: guest is really TWikiGuest
  • Retrieve information about another user:
    • Example: %USERINFO{ "TWikiGuest" format="$username is really $wikiname" }%
    • Expands to: guest is really TWikiGuest
    • Note: The parameter should be the wikiname of a user. Since TWiki 4.2.1, you can also pass a login name. You can only get information about another user if the {AntiSpam}{HideUserDetails} configuration option is not enabled, or if you are an admin. (User details are hidden in this TWiki)
  • Category: SystemInformationVariables, UsersAndAuthenticationVariables
  • Related: USERNAME, WIKINAME, WIKIUSERNAME, TWikiUserAuthentication, ChangeEmailAddress (this topic)

USERNAME -- your login username

USERSWEB -- name of users web

VAR{"NAME" ...} -- get a preference value from another web or topic and more

  • Gets the value of a variable in various manners.
    • If the topic parameter is specified, it gets the value of the specified preferences variable in the specified topic. Please note that the WebPreferences of the web of the specified topic is not examined. So the returned value may not be the same as the value of the variable when the specified topic is viewed.
    • If the topic parameter is not specified and the web parameter is specified, it gets the value of the specified preferences variable in the specified web, which means the specified web's WebPreferences is examined for the variable.
    • If the neither the topic nor web parameter is specified, it gets the value of the specified variable in the current context -- the variable can either be a preferences variable or a session variable but cannot be a tag with a tag handler (e.g. %GMTIME%).
      %VAR{"NAME"}% is similar to %NAME%, but they differ if NAME is undefined, in which case %VAR{"NAME"}% is expanded to null (zero width string) while %NAME% remains as is (%NAME%). %VAR{"NAME"}% yields the same value as %IF{"defined NAME" then="$percntNAME$percnt"}% if NAME is a variable, but the latter is cubmersome.
  • Syntax: %VAR{"NAME" ...}%
  • Supported parameters:
    Parameter: Description: Default:
    "Variable" The name of the variable to be retrieved. If not specified, %VAR{...}% is expanded to null. required
    topic="Web.Topic" Specifies the topic in which the specified preferences vaiable is fetched. none
    topic="Topic" Same as above, but the web is specified specified explicitly with the web parameter or the current web is specified. none
    web="Web" Specifies the web in which the specified preferences variable is fetched. none
    default="Value" Specifies the value to be returned if the specified variable is undefined. "" (null string)
    ignorenull="on" If specified, a null string ("") value is regarded as undefined. This affects whether or not the value specified by the default parameter is returned. "off"
  • Example 1: To get the members of TWikiAdminGroup, %VAR{"GROUP" topic="%USERSWEB%.TWikiAdminGroup"}%, which expands to DamianLyons,TFrancois2.
  • Example 2: To get %WEBBGCOLOR% of the Main web write %VAR{"WEBBGCOLOR" web="Main"}%, which expands to #FFEFA6
  • Example 3: Let's say you are writing the "foo" skin. And you want to have the users specify a string inserted in the head tag with FOOSKIN_HTML_HEAD_HOOK. That can be achived by the following:
    %VAR{"FOOSKIN_HTML_HEAD_HOOK" default="<nop>" ignorenull="on"}%
  • Category: DevelopmentVariables, SystemInformationVariables
  • Related: ALLVARIABLES, WEBPREFSTOPIC (this topic)

WEB -- name of current web

  • %WEB% expands to the name of the web where the topic is located. If you are looking at the text of an included topic, it is the web where the included topic is located.
  • Syntax: %WEB%, expands to: TWiki
  • Syntax: %WEB{format="..."}%
  • Supported parameter:
    Parameter: Description: Default:
    format="..." Format, may include tokens $web (the full web path), $parents (parent webs, if any), $current (current web without parent webs), $top (top-level web with any subwebs removed) "$web"
  • Example, assuming %WEB% is Engineering/TechPubs/Apps:
    %WEB{format="Parent webs: $parents, current web: $current, top-level web: $top"}% returns: Parent webs: Engineering/TechPubs, current web: Apps, top-level web: Engineering
  • Category: SystemInformationVariables
  • Related: BASEWEB, INCLUDINGWEB, TOPIC (this topic)

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

  • List of all webs. Obfusticated webs are excluded, e.g. webs with a NOSEARCHALL = on preference variable. The "format" defines the format of one web item. The $name variable gets expanded to the name of the web, $qname gets expanded to double quoted name, $marker to marker where web matches selection.
  • Syntax: %WEBLIST{"format" ...}%
  • Supported parameters:
    Parameter: Description: Default:
    "format" Format of one line, may include following items. In addtion, the standard special tokens are handled accordingly.
    Item Description
    $name the name of the web
    $qname the name of the web in double quotes
    $indentedname the name of the web with parent web names replaced by indents, for use in indented lists
    $listindent expands to multiple-of-3 spaces for bullet (*) and numberd (1., a., etc.) lists. It's relative to the depth of the web specified by the subwebs parameter. See an example below.
    $marker expands to marker for the item matching selection only
    $web expands to the value specified by the web parameter
    If you need to have a letter immediately after an item listed above, use $nop(), one of FormatTokens. e.g. $name$nop()a
    "$name"
    format="format" (Alternative to above) "$name"
    separator=", " Line separator "$n" (new line)
    web="" if you specify $web in format, it will be replaced with this ""
    webs="public" Comma separated list of webs. There are special webs:
    Item Description
    public expands to all non-hidden webs.
    cancopyto similar to public, but webs to which a topic of the current web cannot be copied to are excluded. Specifically, excluded are read-only webs and mirror webs.
    canmoveto similar to cancopyto, but webs to which a topic of the current web cannot be moved to are excluded. Specifically, excluded are webs residing on different disks from the current web.
    webtemplate expands to all template webs, whose name start with underscore (_)
    NOTE 1: Administrators will see all webs, not just the public ones.
    NOTE 2: If MetadataRepository is used and webs are required to be registered, then cancopyto, canmoveto, and webtemplate behave differently.
    • cancopyto and canmoveto results include all top level webs and subwebs of the current webs are listed regardless of accessibility - subwebs of non-current webs are excluded. They also include the user's subweb.
    • webtemplate result has top level template webs only.
    "public"
    marker="selected" Text for $marker if the item matches selection "selected"
    selection="%WEB%" Current value to be selected in list selection="%WEB%"
    subwebs="Sandbox" Show webs that are a sub-web of this one (recursivly) ""
    depth="1" Specify the maximum depth of recursive search. E.g. %WEBLIST{depth="1"}% shows only top level webs. %WEBLIST{subwebs="Foo" depth="1"}% shows the direct subwebs of Foo. (no maximum depth)
    limit="30" Limit number of webs to show "" (all)
    overlimit="..." Message shown if over limit, such as: overlimit="   * [[%SYSTEMWEB%.SiteMap][More...]]" ""
  • Example: %WEBLIST{"$listindent   * [[$name.WebHome]]"}% - creates a indented bullet list of all webs.
  • Example: <form><select name="web"> %WEBLIST{"<option $marker value=$qname>$name</option>" webs="Trash, public" selection="%WEB%" separator=" "}% </select></form> - creates a dropdown of all public webs + Trash web, with the current web highlighted.
  • Category: SearchingAndListingVariables, SystemInformationVariables
  • Related: TOPICLIST, SEARCH, MetadataRepository, ReadOnlyAndMirrorWebs, UsingMultipleDisks (this topic)

WEBPREFSTOPIC -- name of web preferences topic

WIKIHOMEURL -- site home URL

WIKILOGOALT -- site logo tooltip message

WIKILOGOIMG -- site logo image URL

WIKILOGOURL -- site logo 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

Total: 73 variables

Related Topics: TWikiVariables, TWikiVariablesSearch, TWikiVariablesQuickStart

 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 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
Note: Please contribute updates to this topic on TWiki.org at TWiki:TWiki.SystemInformationVariables.