TWiki Variables Ato M
TWiki
Note: This topic is included by
TWikiVariables
ATTACHURL -- full URL for attachments in the current topic
ATTACHURLPATH -- path of the attachment URL of the current topic
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
DISPLAYTIME -- display time
DISPLAYTIME{"format"} -- formatted display time
- Formatted time - either GMT or Local server time, depending on setting in TWiki.cfg. Same format qualifiers as
%GMTIME%
- Syntax:
%DISPLAYTIME{"format"}%
- Example:
%DISPLAYTIME{"$hou:$min"}%
expands to 00:57
- 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
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 | "$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 |
$wday | day of the Week (Sun, Mon, Tue, Wed, Thu, Fri, Sat) | Thu |
$http | E-mail & http format timestamp | Sat, 25 Jul 2020 00:57:10 GMT |
$tz | either "GMT" (if set to gmtime), or "Local" (if set to servertime) | GMT |
$month | month in ISO format | Dec |
$ye | 2 digit year | 99 |
$seconds | seconds | 59 |
$minutes | minutes | 59 |
$day | day of month | 31 |
$hours | hours | 23 |
$rcs | RCS format timestamp | 2020/07/25 00:57:10 |
$iso | ISO format timestamp | 2020-07-25T00:57Z |
$year | 4 digit year | 1999 |
$mo | 2 digit month | 12 |
- Variables can be shortened to 3 characters
- Example:
%GMTIME{"$day $month, $year - $hour:$min:$sec"}%
expands to 25 Jul, 2020 - 00:57:10
- Related: DISPLAYTIME, GMTIME, SERVERTIME
HOMETOPIC -- home topic in each web
HTTP_HOST -- environment variable
ICON{"type"} -- small icon of common attachment types
- Small 16x16 pixel icon of common attachment types. Specify file type only, file name, or full path name
- Syntax:
%ICON{"type"}%
- Samples:
bmp
, doc
, gif
, hlp
, html
, mp3
, pdf
, ppt
, txt
, xls
, xml
, zip
- Example:
%ICON{"pdf"}%
expands to
- Related: TWikiPreferences, FileAttachments, TWikiDocGraphics
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/"}% Note 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) | %INCLUDE- WARNING% preferences setting |
- Related: BASETOPIC, BASEWEB, INCLUDINGTOPIC, INCLUDINGWEB, IncludeTopicsAndWebPages, STARTINCLUDE, STOPINCLUDE,
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
MAINWEB -- name of Main web
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 | 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 |
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: "}%
- Related: SEARCH
--
TWiki:Main.PeterThoeny - 14 Aug 2004