1
## Please edit system and help pages ONLY in the moinmaster wiki! For more
2
## information, please see MoinMaster:MoinPagesEditorGroup.
1
## Please edit system and help pages ONLY in the master wiki!
2
## For more information, please see MoinMoin:MoinDev/Translation.
3
3
##master-page:Unknown-Page
4
4
##master-date:Unknown-Date
5
#acl MoinPagesEditorGroup:read,write,delete,revert All:read
5
#acl -All:write Default
8
== Help on Variables ==
10
=== predefined variables ===
11
The following variables are substituted when a page is saved. Note that they will appear unreplaced in the preview!
9
This page tells you more how you can use variables in wiki pages. This is especially helpful within [[HelpOnTemplates|templates]], but also on "normal" wiki pages (like for signing a contribution).
13
== Predefined Variables ==
14
The following variables are substituted when a page is saved. '''''Note that they will appear unreplaced in the preview!'''''
13
16
|| Variable || Description || Example ||
14
17
|| @``PAGE@ || Name of the page (useful for template pages) || HelpOnPageCreation ||
15
|| @``DATE@ || Current date in the system's format || [[Date(2004-08-30T06:38:05Z)]] ||
16
|| @``TIME@ || Current date and time in the user's format || [[DateTime(2004-08-30T06:38:05Z)]] ||
18
|| @``DATE@ || Current date in the system's format || <<Date(2004-08-30T06:38:05Z)>> ||
19
|| @``TIME@ || Current date and time in the user's format || <<DateTime(2004-08-30T06:38:05Z)>> ||
20
|| @``ME@ || Just the user's name || TheAnarcat ||
17
21
|| @``USERNAME@ || Just the user's name (or his domain/IP) || TheAnarcat ||
18
22
|| @``USER@ || Signature "-- loginname" || -- TheAnarcat ||
19
|| @``SIG@ || Dated Signature "-- loginname date time" || -- TheAnarcat [[DateTime(2004-08-30T06:38:05Z)]] ||
20
|| @``MAILTO@ || A fancy mailto: link with the user's data || None - on public sites, better use the Mail``To macro) ||
23
== expanding variables ==
25
You can use Home``Page``Name/My``Dict to expand those variables, just put a Wiki``Dict there with your variables and values. For example,
23
|| @``SIG@ || Dated Signature "-- loginname date time" || -- TheAnarcat <<DateTime(2004-08-30T06:38:05Z)>> ||
24
|| @``MAILTO@ || A fancy mailto: link with the user's data || None - on public sites, better use the Mail``To macro ||
27
== Expanding Variables ==
29
You can use Home``Page``Name/My``Dict to expand those variables, just put a dictionary (see HelpOnDictionaries) there with your variables and values. For example,
27
31
VAR1:: substitution 1
28
32
VAR2:: substitution 2
31
If you make a page ending with `.*Dict` (see page_dict_regex), you can set some variables to specific values:
36
The actual format of the variable assignment above when editing in the edit window is the following:
42
The leading space and the space after '::' are important.
44
== getting variables ==
36
== Getting Variables ==
46
38
=== At Every Page Refresh ===
48
40
You can use these values using the `GetVal` macro:
51
[[GetVal(WikiDict,var1)]] [[GetVal(WikiDict,var2)]] [[GetVal(WikiDict,var3)]]
43
<<GetVal(WikiDict,var1)>> <<GetVal(WikiDict,var2)>> <<GetVal(WikiDict,var3)>>
56
[[GetVal(WikiDict,var1)]] [[GetVal(WikiDict,var2)]] [[GetVal(WikiDict,var3)]]
48
<<GetVal(WikiDict,var1)>> <<GetVal(WikiDict,var2)>> <<GetVal(WikiDict,var3)>>
58
50
=== When Saving the Page ===
64
56
/!\ Note that data in dict pages is cached and does not require opening and parsing the page file for each access to the value. In CGI, the value is fetched from a pickle, in long running process, the pickle is loaded once and then the value is accessed from memory.
66
/!\ Note that saving template pages and using preview does ''not'' expand variables. Other than that, variable expansion is very global and happens anywhere on the page, including code displays, comments, processing instructions and other "special" areas of a page you might think are excluded. See HelpOnTemplates for more information about using templates.
58
/!\ Note that saving template pages and using preview does ''not'' expand variables. Other than that, variable expansion is very global and happens anywhere on the page, including code displays, comments, processing instructions and other "special" areas of a page you might think are excluded.