You are here: FS > TWiki Web > TWikiVariables > TWikiVariablesAtoM r2 - 27 Oct 2005 - 01:05 - TWikiContributor


Start of topic | Skip to actions
Note: This topic is included by TWikiVariables


ACTIVATEDPLUGINS -- list of currently activated plugins

ATTACHURL -- full URL for attachments in the current topic

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

AUTHREALM -- authentication realm

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%
  • Related: BASEWEB, INCLUDINGTOPIC, INCLUDE, 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%
  • Related: BASETOPIC, INCLUDINGWEB, INCLUDE, WEB

DATE -- signature format date

DISPLAYTIME -- display time

DISPLAYTIME{"format"} -- formatted display time

  • Formatted time - either GMT or Local server time, depending on setting in configure. Same format qualifiers as %GMTIME%
  • Syntax: %DISPLAYTIME{"format"}%
  • Example: %DISPLAYTIME{"$hou:$min"}% expands to 20:04
  • Related: DISPLAYTIME, GMTIME, SERVERTIME

ENCODE{"string"} -- encodes a string

  • Syntax: %ENCODE{"string"}%
  • Supported parameters:
    Parameter: Description: Default:
    "string" String to encode required (can be empty)
    type="entity" Encode special characters into HTML entities, like a double quote into " URL encoding
    type="url" Encode special characters for URL parameter use, like a double quote into %22 (this is the default)
  • Example: %ENCODE{"spaced name"}% expands to spaced%20name
  • Related: URLPARAM

ENDSECTION{"name"} -- marks the end of a named section

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

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

  • Syntax: %FORMFIELD{"fieldname"}%
  • Supported parameters:
    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 field title "$value"
    default="..." Text shown when no value is defined for the field ""
    alttext="..." Text shown when field is not found in the form ""
  • Example: %FORMFIELD{"ProjectName" topic="Projects.SushiProject" default="(not set)" alttext="ProjectName field found"}%
  • Related: SEARCH

GMTIME -- GM time

GMTIME{"format"} -- formatted GM time

  • Syntax: %GMTIME{"format"}%
  • Supported variables:
    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 month in ISO format 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 2026-05-31T20:04Z
    $rcs RCS format timestamp 2026/05/31 20:04:20
    $http E-mail & http format timestamp Sun, 31 May 2026 20:04:20 GMT
    $epoch Number of seconds since 00:00 on 1st January, 1970 1780257860
  • Variables can be shortened to 3 characters
  • Example: %GMTIME{"$day $month, $year - $hour:$min:$sec"}% expands to 31 May, 2026 - 20:04:20
  • ALERT! Note: 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.
  • Related: DISPLAYTIME, GMTIME, SERVERTIME

HOMETOPIC -- home topic in each web

HTTP -- get HTTP headers

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'}%
  • Related: HTTP, REMOTE_ADDR, REMOTE_PORT, REMOTE_USER

HTTP_HOST -- environment variable

ICON{"name"} -- small documentation graphic or icon of common attachment types

  • Small graphic (commonly 16x16 pixels) used to enhance topics. Specify the name of the graphic.
  • A set of 16x16 pixel icons of common attachment types is provided. Specify file type only, file name, or full path name.
  • Syntax: %ICON{"name"}% or %ICON{"type"}%
  • Graphic samples: arrowbright arrowbright, bubble bubble, choice-yes choice-yes, hand hand
  • Filetype samples: bmp bmp, doc doc, gif gif, hlp hlp, html html, mp3 mp3, pdf pdf, ppt ppt, txt txt, xls xls, xml xml, zip zip
  • Example: %ICON{"info"}% expands to info
  • Related: TWikiPreferences, FileAttachments, TWikiDocGraphics

ICONPATH{"name"} -- url path of small documentation graphic or icon of common attachment types

IF{"condition" ...} -- simple conditionals

  • Syntax: %IF{"CONDITION" then="THEN" else="ELSE"}%
  • In the example above, if CONDITION evaluates to TRUE, then THEN will be shown; otherwise ELSE will be shown.
  • Related: IfStatements has more information on how to write %IF{}% statements
  • Related: $IF() of SpreadSheetPlugin

INCLUDE{"page"} -- include other topic or web page

  • Syntax: %INCLUDE{"page" ...}%
  • Supported parameters:
    Parameter: Description: Default:up
    rev="2" Include a previous topic revision; N/A for URLs top revision
    pattern="..." A RegularExpression pattern to include a subset of a topic or page none
    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) on preferences setting
    "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.
    IDEA! if the URL resolves to an attachment file on the server this will automatically translate to a server-side include.
     
    section="name" Includes only the specified section, as defined in the included topic by the SECTION and ENDSECTION variables  
    PARONE="val 1"
    PARTWO="val 2"
    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.  
  • Examples: See IncludeTopicsAndWebPages
  • Related: BASETOPIC, BASEWEB, INCLUDINGTOPIC, INCLUDINGWEB, STARTINCLUDE, STOPINCLUDE, SECTION, ENDSECTION

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%
  • Related: BASETOPIC, INCLUDINGWEB, INCLUDE, 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%
  • Related: BASEWEB, INCLUDINGTOPIC, INCLUDE, WEB

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"
    sep separator between items. "\n" (newline)
  • format variables:
    Variable Meaning
    $langname language's name, as informed by the translators
    $langtag language's tag. Ex: en, pt-br, etc.

LOCALSITEPREFS -- web.topicname of site preferences topic

  • The full name of the local site preferences topic. This topic is read for preferences before TWiki.%TWIKIPREFSTOPIC% is read.
  • Syntax: %LOCALSITEPREFS%
  • Expands to: Main.TWikiPreferences

LOGIN -- present a full login link

LOGOUT -- present a full logout link

MAKETEXT -- creates text using TWiki's I18N infrastructure

  • Syntax = %MAKETEXT{"string" args="..."}
  • Supported parameters:
    Parameter Description Default
    "text" or string="text" The text to be displayed. none
    args="param1, param2" a comma-separated list of arguments to be interpolated in the string, replacing the [_N] placeholders in it. none
  • Examples:
    • %MAKETEXT{string="Notes:"}%
      expands to
      Notes:
    • %MAKETEXT{"Contact [_1] if you have any questions." args="%WIKIWEBMASTER%"}%
      expands to
      Contact jpw@rainysky.org if you have any questions.
    • %MAKETEXT{"Did you want to [[[_1]][reset [_2]'s password]]?" args="TWiki.ResetPassword,%WIKIUSERNAME%"}%
      expands to
      Did you want to reset Main.TWikiGuest's password?
  • Notes:
    • that TWiki will translate the string to the current user's language only if it has such string in its translation table for that language.
    • Amperstands (&) followed by one letter (one of a...z, A...Z) (say, X) in the translatable string will be translated to <span class='twikiAccessKey'>X</span>. This is used to implement access keys. If you want to write an actual amperstand that stays just before a letter, write two consecutive amperstands (&&): they will be transformed in just one.
    • translatable string starting with underscores (_) are reserved. You should not use translatable phrases starting with an underscore.

MAINWEB -- name of Main web

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 Show a single form field
    "form" none Generates the table showing the form fields. See Form Templates
    "attachments" all="on" to show hidden attachments Generates the table showing the attachments
    "moved" none 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 "".
    suffix="...": Suffix, only appears if there are parents, default "".
    separator="...": Separator between parents, default is " > ".
    Generates the parent link
  • Related: METASEARCH

METASEARCH -- special search of meta data

  • Syntax: %METASEARCH{...}%
  • Supported parameters:
    Parameter: Description: Default:
    type="topicmoved" What sort of search is required?
    "topicmoved" if search for a topic that may have been moved
    "parent" if searching for topics that have a specific parent i.e. its children
    "field" if searching 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, for topicmoved and parent searches current topic
    name form field to search, for field type searches. May be a regular expression (see SEARCH).  
    value form field value, for field type searches. May be a regular expression (see SEARCH).  
    title="Title" Text that is prefixed to any search results empty
    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"}%
  • Related: SEARCH, META

Related Topics: UserDocumentationCategory

Edit | Attach | Printable | Raw view | Backlinks: Web, All webs | History: r2 < r1 | More topic actions
This site is powered by the TWiki collaboration platformCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding FS? Send feedback