Skip to topic | Skip to bottom
Powered by TWiki
You are here: TWiki > 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 17:24
  • 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

  • Syntax: %ENDSECTION{"name"}%
  • Supported parameters:
    Parameter: Description: Default:
    "name" Name of the section. Must be unique inside a topic, and must match with a previous %SEcTION% tag. Mandatory parameter without a default
  • Related: INCLUDE, 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 2008-11-21T17:24Z
    $rcs RCS format timestamp 2008/11/21 17:24:33
    $http E-mail & http format timestamp Fri, 21 Nov 2008 17:24:33 GMT
    $epoch Number of seconds since 00:00 on 1st January, 1970 1227288273
  • Variables can be shortened to 3 characters
  • Example: %GMTIME{"$day $month, $year - $hour:$min:$sec"}% expands to 21 Nov, 2008 - 17:24:33
  • warning Note: When used in a template topic, this variable will be expanded when the template is used to create a new topic. See TWikiTemplates for details.
  • Related: DISPLAYTIME, GMTIME, SERVERTIME

HOMETOPIC -- home topic in each web

HTTP -- get HTTP headers

  • Called with the name of an HTTP header field, returns its value. Capitalization and the use of hyphens versus underscores are not significant.
  • Syntax: %HTTP%
  • Syntax: %HTTP{'Header-name'}%
  • Examples:
    %HTTP%  
    %HTTP{"Accept-language"}% en-us,en;q=0.5
    %HTTP{"User-Agent"}% CCBot/1.0 (+http://www.commoncrawl.org/bot.html)
  • Note: You can see the HTTP headers your browser sends to the server on a number of sites e.g. http://www.ericgiguere.com/tools/http-header-viewer.html
  • Related: HTTPS, REMOTE_ADDR, REMOTE_PORT, REMOTE_USER

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 topics or web pages

  • Syntax: %INCLUDE{"page" ...}%
  • Supported parameters:
    Parameter: Description: Default:
    "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/"}%
    tip if the URL resolves to an attachment file on the server this will automatically translate to a server-side include.
     
    pattern="..." A RegularExpression pattern to include a subset of a topic or page none
    rev="1.2" Include a previous topic revision; N/A for URLs top revision
    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
    section="name" Includes only the specified section, as defined in the included topic by the SECTION and ENDSECTION tags  
    Any other parameters will be defined as variables within the scope of the included topic. For example, %INCLUDE{"AnotherTopic" PONE="val 1" PTWO="val 2"}% will result in %PONE% and %PTWO% being defined within the included topic.
  • Example: To include a part of a webpage, use this pattern: %INCLUDE{"http://some.page.com/index.html" pattern="^.*?BEFORE(.*)AFTER.*" }%, where BEFORE is the part of the page just before the inclusion, and AFTER is the part just after the inclusion.
  • Related: BASETOPIC, BASEWEB, INCLUDINGTOPIC, INCLUDINGWEB, IncludeTopicsAndWebPages, 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 -- TWiki available 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 shadow@dementia.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?
  • Note 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.

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 © 1999-2008 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback