%ACTIVATEDPLUGINS%
%ADDTOHEAD{}%
expands in-place to an empty string, unless there is an error in which case the variable expands to an error string.
%ADDTOHEAD{ "..." text="..." }%
|
|||||||||||||||||||
%ADDTOHEAD{ "MYBOX_CSS" text="<style type=\"text/css\"> .myBox { height: 22px; background-color: #AFB3C5; } </style>" }%
(this topic)
%CALC{formula}%
variable is handled by the SpreadSheetPlugin. Over 100 functions are available, such as $ABS()
, $EXACT()
, $EXISTS()
, $GET()/$SET()
, $IF()
, $LOG()
, $LOWER()
, $PERCENTILE()
, $TIME()
, $VALUE()
.
%CALC{formula}%
%CALC{$SUM($ABOVE())}%
returns the sum of all cells above the current cell
%CALC{$EXISTS(Web.SomeTopic)}%
returns 1
if the topic exists
%CALC{$UPPER(Collaboration)}%
returns COLLABORATION
%INCLUDE{%CALC{...}%}%
) because it does not get evaluated inside-out & left-to-right like ordinary TWiki variables. Use CALCULATE if you nest variables.
%CALCULATE{formula}%
variable is handled by the SpreadSheetPlugin. Over 100 functions are available, such as $ABS()
, $EXACT()
, $EXISTS()
, $GET()/$SET()
, $IF()
, $LOG()
, $LOWER()
, $PERCENTILE()
, $TIME()
, $VALUE()
.
%CALC{formula}%
%CALC{$EXISTS(Web.SomeTopic)}%
returns 1
if the topic exists
%CALC{$UPPER(Collaboration)}%
returns COLLABORATION
$LEFT()
or $T()
. Use CALC instead.
%DASHBOARD{...}%
variable.
%DASHBOARD{ section="..." ... }%
%DASHBOARD{ section="dashboard_start" }%
%DASHBOARD{ section="banner" image="..." title="..." }%
%DASHBOARD{ section="box_start" title="Box 1 title" }%
Box 1 content
%DASHBOARD{ section="box_end" }%
%DASHBOARD{ section="box_start" title="Box 2 title" }%
Box 2 content
%DASHBOARD{ section="box_end" }%
...
%DASHBOARD{ section="dashboard_end" }%
%EDITFORMFIELD{"fieldname" form="...Form"}%
- create form field defined in a TWiki Form template
%EDITFORMFIELD{"fieldname" topic="..."}%
- create form field based on a topic that has a TWiki Form & initialize its value
%EDITFORMFIELD{"fieldname" type="..."}%
- create an HTML input field
|
|||||||||||||||||||||||||||
%EDITFORMFIELD{ "ReleaseType" form="PackageForm" value="Beta-1" }%
%EDITFORMFIELD{ "form" type="start" action="save" topic="%BASEWEB%.%BASETOPIC%" method="post" }%
| Priority: | %EDITFORMFIELD{ "Priority" topic="%BASETOPIC%" }% |
| Status: | %EDITFORMFIELD{ "Status" topic="%BASETOPIC%" }% |
| | %EDITFORMFIELD{ "form" type="submit" value="Update" }% |
%EDITFORMFIELD{ "Updated" type="hidden" value="%SERVERTIME{$year-$mo-$day}%" }%
%EDITFORMFIELD{ "form" type="end" }%
"\n"
) and linefeed ("\r"
)
"<"
, ">"
, "&"
, single quote ('
) and double quote ("
)
"%"
, "["
, "]"
, "@"
, "_"
, "*"
, "="
and "|"
%ENCODE{"string"}%
|
||||||||||||||||||||||||||||
%ENCODE{"spaced name"}%
expands to spaced%20name
%ENCODE{"spaced name" type="entity" extra=" "}%
expands to spaced name
"html"
. A shorter %ENTITY{any text}%
can be used instead of the more verbose %ENCODE{ "any text" type="html" }%
. <input type="text" name="address" value="%ENTITY{any text}%" />
%SEARCH{ "%ENCODE{ "string with "quotes"" type="quotes" }%" noheader="on" }%
type="moderate"
, type="safe"
, type="entity"
or type="html"
to protect user input from URL parameters and external sources against cross-site scripting (XSS). type="html"
is the safest mode, but some TWiki applications might not work. type="safe"
provides a safe middle ground, type="moderate"
provides only moderate cross-site scripting protection.
%ENDSECTION{"name"}%
%ENDSECTION{type="include"}%
%ENDSECTION{type="templateonly"}%
%ENDSECTION{type="expandvariables"}%
|
|||||||
STARTSECTION
is named, the corresponding ENDSECTION
must also be named with the same name. If the STARTSECTION
specifies a type, then the corresponding ENDSECTION
must also specify the same type. If the section is unnamed, ENDSECTION
will match with the nearest unnamed %STARTSECTION%
of the same type above it.
"\n"
) and linefeed ("\r"
)
"<"
, ">"
, "&"
, single quote ('
) and double quote ("
)
"%"
, "["
, "]"
, "@"
, "_"
, "*"
, "="
and "|"
%ENTITY{string}%
%ENTITY{text with "quotes" and
newline}%
expands to text with "quotes" and newline
<input type="text" name="address" value="%ENTITY{any text}%" />
%ENTITY{string}%
is roughly equivalent to %ENCODE{ "string" type="html" }%
, but the latter cannot handle strings that have double quotes embedded in it.
%EXAMPLEVAR{}%
variable is handled by the EmptyPlugin
%EXAMPLEVAR{"text" format="..."}%
text="..."
- example text.
format="..."
- format of report.
%EXAMPLEVAR{"hello" format="| $topic: $summary |"}%
%FORMFIELD{"fieldname"}%
|
||||||||||||||||||||||||||||
%FORMFIELD{"ProjectName" topic="Projects.SushiProject" default="(not set)" alttext="ProjectName field not found"}%
<input type="text" name="Address" value="%FORMFIELD{ "Address" encode="html" }%" />
%SET{}%
. The %SET{}%
and %GET{}%
variables are handled by the SetGetPlugin.
%GET{ "name" default="..." }%
|
|||||||||||||
%GET{"lunch"}%
returns Sushi
if the following has been previously set:%SET{ "lunch" value="Sushi" }%
- see more examples
%IF{"CONDITION" then="THEN" else="ELSE"}%
shows "THEN"
if "CONDITION"
evaluates to TRUE
, otherwise "ELSE"
will be shown
%IF{"defined FUNFACTOR" then="FUNFACTOR is defined" else="FUNFACTOR is not defined"}%
renders as FUNFACTOR is not defined
%INCLUDE{"page" ...}%
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
%INCLUDE{"http://www.google.com/"}%
is turned off by default. To turn this on, ask your TWiki administrator to enable the {INCLUDE}{AllowURLs}
flag in the Security setup section of configure.
raw
or disableremovescript
parameter.
%MAKETEXT{"string" args="..."}%
|
||||||||||
%MAKETEXT{string="Notes:"}%
%MAKETEXT{"If you have any questions, please contact [_1]." args="%WIKIWEBMASTER%"}%
%MAKETEXT{"Did you want to [[[_1]][reset [_2]'s password]]?" args="%SYSTEMWEB%.ResetPassword,%WIKIUSERNAME%"}%
string
to the current user's language only if it has such string in its translation table for that language.
&
) 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.
_
) are reserved. You must not use translatable phrases starting with an underscore.
%VARIABLES%
inside the translatable strings (since they will get expanded before the %MAKETEXT{...}%
itself is handled).
%QUERYPARAMS{...}%
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.
|
|||||||||||||||||||||||
%QUERYPARAMS{format="<input type='hidden' name='$name' value='$value' encoding="html" />"}%
%QUERYPARAMS%
.
%QUERYSTRING%
skin=print.myskin
%REMOTE_ADDR%
172.31.0.2
%REMOTE_PORT%
%REMOTE_USER%
viewauth.cgi
)
%SCRIPTNAME%
view
.pl
or .cgi
%SCRIPTSUFFIX%
%SCRIPTURL%
https://www.linux4sam.org/bin
edit
script should always be used in conjunction with ?t=%GMTIME{"$epoch"}%
to ensure pages about to be edited are not cached in the browser
edit
, save
, attach
, upload
, and rename
, the URL on the master site is returned. master="on"
parameter is specified, the URL on the master site is returned.
%SCRIPTURL{"script" ...}%
|
||||||||||||||||
web="WEB"
is specified but topic
is not specified, the resulting URL ends with WEB
.
%SCRIPTURL{"viewauth"}%/%WEB%/%TOPIC%
which expands to https://www.linux4sam.org/bin/viewauth/TWiki/TWikiVariablesCategoryBody
. It can be written %SCRIPTURL{"viewauth" topic="%TOPIC%"}%
as well.
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.
%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.
[[%SCRIPTURL{view}%/%WEB%/MyQuery?food=sushi][Sushi]]
%SCRIPTURLPATH{"script"}%
instead, as it works with URL rewriting much better
%SCRIPTURL%
, but doesn't include the protocol and host part of the URL
%SCRIPTURLPATH%
/bin
edit
script should always be used in conjunction with ?t=%GMTIME{"$epoch"}%
to ensure pages about to be edited are not cached in the browser
%SCRIPTURL{"script"}%
, but doesn't include the protocol and host part of the URL
%SCRIPTURL{"script"}%
, this variable is aware of ReadOnlyAndMirrorWebs. So it may return a URL of a different site.
%SCRIPTURLPATH{"script" ...}%
|
||||||||||||||||
web="WEB"
is specified but topic
is not specified, the resulting URL ends with WEB
.
%SCRIPTURLPATH{"view"}%
expands to "/bin/view"
(This might be a null string. Hence surrounded by double quotes)
%SCRIPTURLPATH{"view" web="%WEB%"}%
expands to /bin/view/TWiki
%SCRIPTURLPATH{"view" topic="%TOPIC%"}%
expands to /bin/view/TWiki/VarSCRIPTURLPATH2
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.
%SEARCH{"text" ...}%
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
%SEARCH{"wiki" web="Main" scope="topic"}%
%SEARCH{"FAQ" scope="topic" nosearch="on" nototal="on" header="| *Topic: * | *Summary: * |" format="| $topic | $summary |"}%
(displays results in a table with header - details)
%TABLE{}%
variable just before the %SEARCH{}%
to alter the output of a search. Example: %TABLE{ tablewidth="90%" }%
%SESSIONID%
%SESSIONVAR%
%SESSION_VARIABLE{"name"}%
- read a session variable
%SESSION_VARIABLE{"name" set="value"}%
- set a session variable
%SESSION_VARIABLE{"name" clear=""}%
- clear a session variable
%SESSION_VARIABLE{"AUTHUSER"}%
- user ID, current value:
%SESSION_VARIABLE{"SESSION_REQUEST_NUMBER"}%
- number of pages accessed by current user since login, current value:
%GET{}%
. No output is shown, e.g. %SET{}%
resolves to an empty string. The %SET{}%
and %GET{}%
variables are handled by the SetGetPlugin.
%SET{ "name" value="..." remember="1" }%
|
|||||||||||||
%SET{"lunch" value="Sushi"}%
- see more examples.
%SET{}%
. The %SETGETDUMP{}%
, %SET{}%
, and %GET{}%
variables are handled by the SetGetPlugin.
%SETGETDUMP{ format="..." separator="..." }%
|
||||||||||
%SETGETDUMP{"| $name | $value |" separator="$n"}%
- see more examples.
%STOPINCLUDE%
variable. A normal view of the topic shows everything exept the %STARTINCLUDE%
variable itself.
%STARTSECTION{type="include"}%
instead
%STARTINCLUDE%
%STARTSECTION{}%
and %ENDSECTION{}%
.
type="section"
- the default, used for a generic section, such as a named section used by INCLUDE.
type="include"
- like %STARTINCLUDE%
... %STOPINCLUDE%
except that you can have as many include blocks as you want (%STARTINCLUDE%
is restricted to only one).
type="templateonly"
- start position of text to be removed when a template topic is used. Use this to embed text that you do not want expanded when a new topic based on the template topic is created. TWikiTemplates has more.
type="expandvariables"
- start position where TWikiVariables get expanded when a new topic is created. As documented in TWikiTemplates#VariableExpansion, only certain variables get expanded when a new topic based on the template topic is created. All variables get expanded within a "expandvariables"
section.
%STARTSECTION{"name"}% ................... %ENDSECTION{"name"}%
%STARTSECTION{type="include"}% ........... %ENDSECTION{type="include"}%
%STARTSECTION{type="templateonly"}% ...... %ENDSECTION{type="templateonly"}%
%STARTSECTION{type="expandvariables"}% ... %ENDSECTION{type="expandvariables"}%
|
|||||||||||||
_SECTION0
for the first unnamed section in the topic, _SECTION1
for the second, etc..
%STOPINCLUDE%
variable itself.
%STOPINCLUDE%
%URLPARAM{"name"}%
|
|||||||||||||||||||||||||||||||||||||||||||
%URLPARAM{"skin"}%
returns print
for a .../view/TWiki/TWikiVariablesCategoryBody?skin=print
URL
encode="safe"
is the default, it provides a safe middle ground. The encode="entity"
is more aggressive, but some TWiki applications might not work.
"html"
. <input type="text" name="address" value="%URLPARAM{ "address" encode="html" }%" />
%SEARCH{ "%URLPARAM{ "search" encode="quotes" }%" noheader="on" }%
rev
, skin
, template
, topic
, web
; they have a special meaning in TWiki. Common parameters and view script specific parameters are documented at TWikiScripts.
%URLPARAM{
in the value of a URL parameter, it will be modified to %<nop>URLPARAM{
. This is to prevent an infinite loop during expansion.
%USERREPORT{ action="..." ... }%
|
|||||||||||||||||||||||||
%USERREPORT{ action="user_list" search="jane" limit="5" }%
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.
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.
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.
%VAR{"NAME" ...}%
|
||||||||||||||||||||||
%VAR{"GROUP" topic="%USERSWEB%.TWikiAdminGroup"}%
, which expands to TWikiAdminUser, RfoLnx4sam
.
%WEBBGCOLOR%
of the Main web write %VAR{"WEBBGCOLOR" web="Main"}%
, which expands to #FFEFA6
%VARVAL{"FOOSKIN_HTML_HEAD_HOOK" default="<nop>" ignorenull="on"}%